You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2025/07/07 19:04:30 UTC

(grails-core) branch 7.0.x updated: [skip ci] ci: cancel in progress actions

This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/grails-core.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new b431f37c6c [skip ci] ci: cancel in progress actions
b431f37c6c is described below

commit b431f37c6c495d533910291a0410386fe9315a2a
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Mon Jul 7 15:04:21 2025 -0400

    [skip ci] ci: cancel in progress actions
---
 .github/workflows/release-abort-release.yml | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/.github/workflows/release-abort-release.yml b/.github/workflows/release-abort-release.yml
index 0269a784de..adf7e65fc8 100644
--- a/.github/workflows/release-abort-release.yml
+++ b/.github/workflows/release-abort-release.yml
@@ -26,6 +26,9 @@ on:
         required: true
         default: 'grails-core'
         type: string
+permissions:
+  contents: write
+  actions: write
 jobs:
   abort:
     name: "Abort Release"
@@ -78,6 +81,28 @@ jobs:
           svnmucc --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive \
                       -m "Remove grails dev version $VERSION" \
                       rm "https://dist.apache.org/repos/dist/dev/incubator/grails/core/$VERSION"
+      - name: "Cancel GitHub Actions"
+        continue-on-error: true
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          OWNER: ${{ github.repository_owner }}
+          REPO: ${{ github.event.inputs.repository_name }}
+        run: |
+          for status in queued in_progress; do
+            curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
+                 -H "Accept: application/vnd.github+json" \
+                 "https://api.github.com/repos/$OWNER/$REPO/actions/runs?event=release&status=$status&per_page=100" |
+            jq -r '.workflow_runs[].id'
+          done > run-ids.txt
+          
+          while read run_id; do
+            echo "cancelling $run_id"
+            curl -s -X POST \
+            -H "Authorization: Bearer $GITHUB_TOKEN" \
+            -H "Accept: application/vnd.github+json" \
+            "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$run_id/cancel"
+          done < run-ids.txt
+          rm -f run-ids.txt || true
       - name: "Remove GitHub Release & Tag"
         continue-on-error: true
         env: