volatilemolotov commented on code in PR #27852: URL: https://github.com/apache/beam/pull/27852#discussion_r1285988074
########## .github/workflows/README.md: ########## @@ -19,13 +19,71 @@ On top of normal Actions workflow steps, all new CI workflows (excluding release workflows or other workflow automation) should have the following: -1) A set of specific triggers -2) An explicit checkout step -3) A set of GitHub token permissions -4) Concurrency Groups -5) Comment Triggering Support +1) Name and phrase set via matrix for re-run to work (See below) +2) A set of specific triggers +3) An explicit checkout step +4) A set of GitHub token permissions +5) Concurrency Groups +6) Comment Triggering Support Each of these is described in more detail below. +## Name and Phrase +Due to specifics on how the comment triggered rerun is handled it is required that all jobs have name and phrase set via matrix elements. See the following example: +``` +jobs: + beam_job_name: + name: ${{ matrix.job_name }} (${{ matrix.job_phrase }}) + strategy: + matrix: + job_name: [beam_job_name] + job_phrase: [Run Job Phrase] + if: | + github.event_name == 'push' || + github.event_name == 'pull_request_target' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' || + github.event.comment.body == 'Run Job Phrase' + steps: + - uses: actions/checkout@v3 + - name: Setup repository + uses: ./.github/actions/setup-action + with: + comment_phrase: ${{ matrix.job_phrase }} + github_token: ${{ secrets.GITHUB_TOKEN }} + github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }}) + +``` +And in case when the workflow already utilizes matrix do the following: +``` +jobs: + beam_job_with_matrix: + name: ${{ matrix.job_name }} (${{ matrix.job_phrase }} ${{ matrix.python_version }}) + runs-on: [self-hosted, ubuntu-20.04, main] + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + job_name: ["beam_job_with_matrix"] + job_phrase: ["Run Job With Matrix"] + python_version: ['3.8','3.9','3.10','3.11'] + if: | + github.event_name == 'push' || + github.event_name == 'pull_request_target' || + github.event_name == 'schedule' || + (github.event.comment.body == 'Run Job With Matrix 3.8' || + github.event.comment.body == 'Job With Matrix 3.9' || Review Comment: Problem is that there are x number of instances which all get a different `inputs.version` due to that being passed on from `matrix`. In that case if a dev issues `Run Python_Precommit 3.9` the `3.8` job will see that comment does not equal `phrase` nor `phrase 3.8` and will issue `gh run cancel` which will cancel the whole run, even the valid job -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org