Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
ci: limiting mirroring concurrency
Browse files Browse the repository at this point in the history
## Problem
Mirroring actions are failing because other actions have already mirrored what
it was about to mirror.

E.g.

* https://github.com/DeveloperC286/starlingbanktechnicalchallenge/actions/runs/7639729071/job/20813352947

```
Run git push --mirror "***gitlab.com/DeveloperC/${REPOSITORY_NAME}"
warning: redirecting to https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge.git/
remote: error: cannot lock ref 'refs/heads/earthly_upgrade': unable to resolve reference 'refs/heads/earthly_upgrade'
remote: error: cannot lock ref 'refs/pull/92/head': reference already exists
To https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge
   f4c0fa2..dfc1c32  main -> main
 ! [remote rejected] earthly_upgrade (failed to update ref)
 ! [remote rejected] refs/pull/92/head -> refs/pull/92/head (failed to update ref)
error: failed to push some refs to 'https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge'
```

* https://github.com/DeveloperC286/starlingbanktechnicalchallenge/actions/runs/7639728988/job/20813352607

```
Run git push --mirror "***gitlab.com/DeveloperC/${REPOSITORY_NAME}"
warning: redirecting to https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge.git/
remote: error: cannot lock ref 'refs/heads/main': is at dfc1c32 but expected f4c0fa2
To https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge
 - [deleted]         earthly_upgrade
 * [new reference]   refs/pull/92/head -> refs/pull/92/head
 ! [remote rejected] main -> main (failed to update ref)
error: failed to push some refs to 'https://gitlab.com/DeveloperC/starlingbanktechnicalchallenge'
```

## Solution
So we are limiting the concurrency to prevent this.

## Related
* https://docs.github.com/en/actions/using-jobs/using-concurrency
* #85
  • Loading branch information
DeveloperC286 committed Jan 24, 2024
1 parent dfc1c32 commit e995f79
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/mirroring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Mirroring

on: [push, delete]

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
GitLab:
runs-on: ubuntu-latest
Expand Down

0 comments on commit e995f79

Please sign in to comment.