Update renovatebot/github-action action to v46.1.3
#122
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Cancels in-progress and queued workflow runs when a PR is closed. | |
| # | |
| # GitHub Actions does not cancel PR-triggered runs on PR close. The concurrency mechanism only | |
| # cancels runs when a *new* run enters the same group, and closing a PR doesn't fire a new | |
| # pull_request event for workflows using default activity types (opened, synchronize, reopened). | |
| # This wastes CI resources, especially for long-running jobs like Nuitka binary builds. | |
| --- | |
| name: ✂️ Cancel runs | |
| "on": | |
| workflow_call: | |
| pull_request: | |
| types: | |
| - closed | |
| jobs: | |
| cancel-runs: | |
| name: ✂️ Cancel PR runs | |
| if: github.event.pull_request.number | |
| runs-on: ubuntu-slim | |
| steps: | |
| - name: Cancel in-progress runs for PR branch | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GH_REPO: ${{ github.repository }} | |
| BRANCH: ${{ github.event.pull_request.head.ref }} | |
| CURRENT_RUN_ID: ${{ github.run_id }} | |
| run: | | |
| # shellcheck disable=SC2153 | |
| branch="${BRANCH}" | |
| # shellcheck disable=SC2153 | |
| current_run_id="${CURRENT_RUN_ID}" | |
| cancelled=0 | |
| for status in in_progress queued; do | |
| while read -r run_id; do | |
| [ -z "$run_id" ] && continue | |
| if [ "$run_id" != "$current_run_id" ]; then | |
| echo "Cancelling run #${run_id} (status: ${status})" | |
| gh api --method POST \ | |
| "repos/{owner}/{repo}/actions/runs/${run_id}/cancel" \ | |
| || true | |
| cancelled=$((cancelled + 1)) | |
| fi | |
| done < <( | |
| gh api "repos/{owner}/{repo}/actions/runs?branch=${branch}&status=${status}" \ | |
| --jq '.workflow_runs[].id' | |
| ) | |
| done | |
| echo "Cancelled ${cancelled} run(s) for branch '${branch}'." |