the `latest` tag should be removed when the CI is done
2bndy5 opened this issue · comments
Just tried to commit to my backlogged-updates branch:
> git pull --tags origin backlogged-updates
From https://github.com/cpp-linter/cpp-linter-action
* branch backlogged-updates -> FETCH_HEAD
! [rejected] latest -> latest (would clobber existing tag)
After #83 was opened, the latest
tag was moved to a different branch which seemed to cause conflicts when my machine tried to do git pull
.
I would suggest
--- a/.github/workflows/run-test.yml
+++ b/.github/workflows/run-test.yml
@@ -23,6 +23,7 @@ jobs:
git push origin latest
test-action:
+ needs: [add-tag]
runs-on: ubuntu-latest
steps:
- uses: convictional/trigger-workflow-and-wait@v1.6.3
@@ -38,6 +39,7 @@ jobs:
trigger_workflow: true
wait_workflow: true
test-package:
+ needs: [add-tag]
runs-on: ubuntu-latest
steps:
- uses: convictional/trigger-workflow-and-wait@v1.6.3
@@ -52,3 +54,14 @@ jobs:
propagate_failure: true
trigger_workflow: true
wait_workflow: true
+ remove-tag:
+ needs: [test-action, test-package]
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ - name: remove latest tag (cleanup)
+ run: |
+ git config user.name 'github-actions'
+ git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
+ git push --delete origin latest || true
Removing the tag latest
let me push/pull again.
CI failed with:
To https://github.com/cpp-linter/cpp-linter-action
- [deleted] latest
To https://github.com/cpp-linter/cpp-linter-action
! [remote rejected] latest -> latest (shallow update not allowed)
error: failed to push some refs to 'https://github.com/cpp-linter/cpp-linter-action'
This is getting annoying when there's 2 PRs open. Related to #71 (see https://github.com/cpp-linter/cpp-linter-action/actions/runs/2845006784)
From the CI failed log, not sure if need to checkout all branches and tags.
This issue should be fixed in #81, can it be closed?
The only thing I did to the workflow in that PR was add the needs: [add-tag]
to the subsequent steps. We can close this for now, but we may encounter this issue again...
I think the main culprit was having more than 1 PR open at the same time, which caused problems moving the latest
tag around difficult because the repo was checked out with a shallow history
cpp-linter-action/.github/workflows/run-test.yml
Lines 15 to 16 in 600b1aa
This could use an added
with:
fetch-depth: 0