cpp-linter / cpp-linter-action

A Github Action for linting C/C++ code integrating clang-tidy and clang-format to collect feedback provided in the form of file-annotations, thread-comments, workflow step-summary, and Pull Request reviews.

Home Page:https://cpp-linter.github.io/cpp-linter-action/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

- name: Checkout
uses: actions/checkout@v3

This could use an added

      with:
        fetch-depth: 0