Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the latest tag should be removed when the CI is done #84

Closed
2bndy5 opened this issue Aug 11, 2022 · 6 comments · Fixed by #89
Closed

the latest tag should be removed when the CI is done #84

2bndy5 opened this issue Aug 11, 2022 · 6 comments · Fixed by #89

Comments

@2bndy5
Copy link
Collaborator

2bndy5 commented Aug 11, 2022

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
@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 11, 2022

Removing the tag latest let me push/pull again.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 11, 2022

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'

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 12, 2022

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)

@shenxianpeng
Copy link
Collaborator

shenxianpeng commented Aug 12, 2022

From the CI failed log, not sure if need to checkout all branches and tags.

@shenxianpeng
Copy link
Collaborator

This issue should be fixed in #81, can it be closed?

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 19, 2022

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

- name: Checkout
uses: actions/checkout@v3

This could use an added

      with:
        fetch-depth: 0

@2bndy5 2bndy5 linked a pull request Aug 19, 2022 that will close this issue
shenxianpeng added a commit that referenced this issue Aug 19, 2022
* Fix add tag failed when more than 1 PR open(#84)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants