diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3347273c9..0e37ae466 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -20,8 +20,18 @@ defaults: shell: bash concurrency: - # At most 1 job per branch. Auto cancel all but scheduled jobs - group: ${{ github.workflow }}-${{ github.ref }} + # At most 1 job per branch. Auto cancel all but scheduled jobs. + # Label events that do not concern the 'pr: dev-coverage' label are given a + # unique concurrency group, so they do not cancel a run that is in progress. + # This way adding the label starts a run, removing it cancels the in-progress + # run, and any other label change has no effect. Note such an event still + # creates a run of this workflow, which is skipped, and would then hide the + # one in progress on the pull request. 'pr-run-cleanup.yml' deletes those. + group: >- + ${{ github.workflow }}-${{ github.ref }}-${{ + (github.event.action == 'labeled' || github.event.action == 'unlabeled') + && github.event.label.name != 'pr: dev-coverage' + && github.run_id || 'shared' }} cancel-in-progress: ${{ github.event_name != 'schedule' }} jobs: @@ -29,13 +39,17 @@ jobs: build: name: Build # Only run scheduled jobs if explicitly enabled for that repo (e.g.: not on forks) - # Only run pull request jobs if labelled as needing an coverage run + # Only run pull request jobs if labelled as needing a coverage run # Always run workflow dispatch jobs if: | (github.event_name == 'schedule' && vars.ENABLE_SCHEDULED_JOBS == 'true') || (github.event_name == 'pull_request' - && contains(github.event.pull_request.labels.*.name, 'pr: dev-coverage')) || + && ((github.event.action == 'labeled' + && github.event.label.name == 'pr: dev-coverage') + || (github.event.action != 'labeled' + && github.event.action != 'unlabeled' + && contains(github.event.pull_request.labels.*.name, 'pr: dev-coverage')))) || (github.event_name == 'workflow_dispatch') uses: ./.github/workflows/reusable-build.yml with: diff --git a/.github/workflows/rtlmeter.yml b/.github/workflows/rtlmeter.yml index e4d6bd504..55ad8530d 100644 --- a/.github/workflows/rtlmeter.yml +++ b/.github/workflows/rtlmeter.yml @@ -22,8 +22,18 @@ defaults: shell: bash concurrency: - # At most 1 job per branch. Auto cancel all but scheduled jobs - group: ${{ github.workflow }}-${{ github.ref }} + # At most 1 job per branch. Auto cancel all but scheduled jobs. + # Label events that do not concern the 'pr: rtlmeter' label are given a + # unique concurrency group, so they do not cancel a run that is in progress. + # This way adding the label starts a run, removing it cancels the in-progress + # run, and any other label change has no effect. Note such an event still + # creates a run of this workflow, which is skipped, and would then hide the + # one in progress on the pull request. 'pr-run-cleanup.yml' deletes those. + group: >- + ${{ github.workflow }}-${{ github.ref }}-${{ + (github.event.action == 'labeled' || github.event.action == 'unlabeled') + && github.event.label.name != 'pr: rtlmeter' + && github.run_id || 'shared' }} cancel-in-progress: ${{ github.event_name != 'schedule' }} jobs: @@ -36,7 +46,11 @@ jobs: (github.event_name == 'schedule' && vars.ENABLE_SCHEDULED_JOBS == 'true') || (github.event_name == 'pull_request' - && contains(github.event.pull_request.labels.*.name, 'pr: rtlmeter')) || + && ((github.event.action == 'labeled' + && github.event.label.name == 'pr: rtlmeter') + || (github.event.action != 'labeled' + && github.event.action != 'unlabeled' + && contains(github.event.pull_request.labels.*.name, 'pr: rtlmeter')))) || (github.event_name == 'workflow_dispatch') || (github.event_name == 'push') runs-on: ubuntu-26.04