1
0
mirror of https://github.com/arduino/library-registry.git synced 2025-07-09 01:42:00 +03:00

Avoid manager workflow run cancelation by incidental events

In order to prevent confusing feedback from the bot, parallel runs of the "Manage PRs" workflow for a given PR are
prevented by canceling any in progress runs for that PR whenever it is triggered.

However, sometimes a trigger event does not result in a run. For example, the workflow is triggered by every comment on
the PR thread, but only those containing the text "ArduinoBot" result in a run. With the previous workflow configuration,
this meant that if anyone made an incidental comment on the PR during a workflow run, the true run was canceled by the
otherwise ignored trigger event, causing a loss of automation.

The solution is to adjust the concurrency configuration so that prior runs in progress are canceled only if the current
trigger event will result in a true run.

I did not indent the added expression because doing so caused validation against the community developed GitHub Actions
workflow JSON schema from the JSON Schema Store to fail.
The reason is that lines with leading whitespace are not folded:
https://yaml.org/spec/1.2.2/#block-folding
Even though the resulting newlines in the expression don't cause any problems for GitHub Actions, the JSON Schema does
not have support for them. Since there is no explicit specification in the GitHub Actions documentation that newlines in
expressions are supported, I am hesitant to propose the necessary change to the schema.
This commit is contained in:
per1234
2021-12-02 03:45:48 -08:00
parent 9245458fe5
commit abec5ec873

View File

@ -26,7 +26,19 @@ on:
concurrency: concurrency:
group: ${{ github.event.pull_request.number }}${{ github.event.issue.number }} group: ${{ github.event.pull_request.number }}${{ github.event.issue.number }}
cancel-in-progress: true cancel-in-progress: >-
${{
(
github.event_name == 'pull_request_target' &&
github.event.pull_request.draft == false
) ||
(
github.event_name == 'issue_comment' &&
github.event.issue.pull_request != '' &&
github.event.issue.state == 'open' &&
contains(github.event.comment.body, 'ArduinoBot')
)
}}
jobs: jobs:
diff: diff: