Commit Graph

19 Commits

Author SHA1 Message Date
Philip Gai
8d10c36b44 feat: add --batch-size flag to push refs in batches (#173)
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
licenses check / licensed check (push) Has been cancelled
goreleaser / goreleaser (push) Has been cancelled
Close inactive issues / close-issues (push) Has been cancelled
* feat: add --batch-size flag to push refs in batches

Add support for pushing refs in smaller batches to avoid server-side
limits and timeouts when syncing large repositories with many tags/branches.

- Add --batch-size flag (default 0 = no batching, original behavior)
- Add References() method to GitRepository interface
- Implement collectRefs() and pushRefsInBatches() helpers
- Add MinBatchSize validation (must be 0 or >= 10)

This addresses issues where repositories with 1000+ refs fail to sync
to GHES with 'command error on refs/heads/<branch>: failed' errors.

* test: add tests for batch-size flag and push batching functionality

* fix: pin tool dependencies to versions compatible with Go 1.21

* ci: fix docker compose v2 syntax and update setup-ruby action

* refactor: address PR review feedback

- Remove unused RefInfo struct from git.go
- Remove redundant pushedAny variable tracking in pushRefsInBatches
- Remove incomplete TestPushRefsInBatches_PartialUpToDate test (already covered by existing test case)

* docs: add --batch-size flag to README
2026-01-27 15:19:55 -06:00
Florian Wagner
e30fad8050 adding missing error handling for GET repo
Signed-off-by: Florian Wagner <h2floh@github.com>
2022-11-04 06:15:14 +00:00
Florian Wagner
ef922b8e3b refactor repository retrieval/creation
Signed-off-by: Florian Wagner <h2floh@github.com>
2022-11-04 04:43:03 +00:00
Florian Wagner
6d732db1cf add push flag to indicate target it GHAE
Signed-off-by: Florian Wagner <h2floh@github.com>
2022-11-03 06:56:42 +00:00
Florian Wagner
86c578bdf2 set visibility to internal for GHAE
Signed-off-by: Florian Wagner <h2floh@github.com>
2022-11-03 06:15:23 +00:00
Ajaykn-mac
0ae35c149f fix go lint 2022-09-26 13:28:19 +09:00
Ajaykn-mac
db79671e1d Fix impersonation token error in case of missing site_admin scope 2022-09-26 12:59:57 +09:00
Denys Zhuravel
4b5fb2c8ad Add a note about the site_admin scope
* add a note to the readme
* add a note to the autogenerated cli help
2022-09-21 12:05:27 +00:00
Denys Zhuravel
37946dfc91 Require site_admin for the impersonation logic
Also, fixed casing in the text literals
2022-09-21 11:59:16 +00:00
Denys Zhuravel
a7d588cf7c Don't enable the impersonation by default.
* Require the impersonation to be explicit with the --actions-admin-user flag
* Reword the log messages to look the same way the existing messages are
2022-09-20 09:48:29 +00:00
Denys Zhuravel
c32265a4df Add actions-admin-user to readme 2022-09-09 09:35:07 +00:00
Denys Zhuravel
7ef65dedf2 Add a --actions-admin-user flag
Same as in here
33463970b8/internal/push/push.go (L106-L113)

Add a warning about the missing site_admin scope in the token
Add a way to ignore the actions admin impersonation.
2022-09-09 09:35:01 +00:00
Florian Wagner
bde5f88201 bump go modules
Signed-off-by: GitHub <noreply@github.com>
2022-04-26 03:37:19 +00:00
Chris Sidi
d39e48f007 Create org if necessary 2020-09-22 13:57:42 -04:00
Chris Sidi
4e5bb47042 Better error message when org doesn't exist
* Produce a better error message when the destination org doesn't exist.
* Support pushing to the authenticated user's account

**Before**
`error creating github repository `synced-actions/setup-node`: error creating repository: POST http://my-ghes-hostname/api/v3/orgs/synced-actions/repos: 404 Not Found []`

**After**
`error creating github repository `synced-actions/setup-node`: Organization `synced-actions` doesn't exist at http://my-ghes-hostname. You must create it first.`

https://github.com/actions/actions-sync/issues/1
2020-09-21 22:08:06 -04:00
Chris Sidi
8862a56600 Honor repo flags on sync and push 2020-09-18 17:15:16 -04:00
Chris Gavin
732ce15227 Fix some incorrect error messages. 2020-08-06 15:03:38 +01:00
Anthony Sterling
c6f5906aa1 add nil check for create repo response 2020-07-13 13:24:20 +01:00
Anthony Sterling
f7954c5ebf Rename project to actions-sync 2020-07-02 19:36:10 +01:00