Release 2.2.0 #11
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
| name: "On Issue Comment" | |
| on: | |
| issue_comment: | |
| types: [created] | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| # This job always runs to prevent GHA from marking the run as failed when | |
| # all other jobs are skipped. | |
| noop: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "No-op" | |
| parse_comment: | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.event.issue.pull_request == null && | |
| contains(github.event.issue.labels.*.name, 'type: release') && | |
| (github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'COLLABORATOR') | |
| outputs: | |
| command: ${{ steps.parse.outputs.command }} | |
| issue_number: ${{ github.event.issue.number }} | |
| backports: ${{ steps.parse.outputs.backports }} | |
| steps: | |
| - name: Parse comment | |
| id: parse | |
| env: | |
| COMMENT_BODY: ${{ github.event.comment.body }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/create-rc([[:space:]]|$)'; then | |
| echo "command=create-rc" >> "$GITHUB_OUTPUT" | |
| elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/prepare([[:space:]]|$)'; then | |
| echo "command=prepare" >> "$GITHUB_OUTPUT" | |
| elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/process-backports([[:space:]]|$)'; then | |
| echo "command=process-backports" >> "$GITHUB_OUTPUT" | |
| elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/add-backports([[:space:]]|$)'; then | |
| args=$(echo "$COMMENT_BODY" | grep -E '^[[:space:]]*/add-backports([[:space:]]|$)' | sed -E 's/^[[:space:]]*\/add-backports[[:space:]]*//') | |
| # Strip leading/trailing spaces and commas | |
| args=$(echo "$args" | sed -e 's/^[[:space:],]*//' -e 's/[[:space:],]*$//') | |
| # Replace internal spaces/commas with single comma | |
| csv=$(echo "$args" | sed -E 's/[[:space:],]+/ /g' | tr ' ' ',') | |
| if [ -n "$csv" ]; then | |
| echo "command=add-backports" >> "$GITHUB_OUTPUT" | |
| echo "backports=$csv" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "command=none" >> "$GITHUB_OUTPUT" | |
| echo "Error: No PRs specified for add-backports." >&2 | |
| gh api \ | |
| --method POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions \ | |
| -f "content=-1" | |
| fi | |
| elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/promote([[:space:]]|$)'; then | |
| echo "command=promote" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "command=none" >> "$GITHUB_OUTPUT" | |
| fi | |
| call_create_rc: | |
| needs: parse_comment | |
| if: needs.parse_comment.outputs.command == 'create-rc' | |
| uses: ./.github/workflows/release_create_rc.yaml | |
| with: | |
| issue: ${{ needs.parse_comment.outputs.issue_number }} | |
| secrets: inherit | |
| call_prepare: | |
| needs: parse_comment | |
| if: needs.parse_comment.outputs.command == 'prepare' | |
| uses: ./.github/workflows/release_prepare.yaml | |
| with: | |
| issue: ${{ needs.parse_comment.outputs.issue_number }} | |
| secrets: inherit | |
| call_process_backports: | |
| needs: parse_comment | |
| if: | | |
| needs.parse_comment.outputs.command == 'process-backports' || | |
| needs.parse_comment.outputs.command == 'add-backports' | |
| uses: ./.github/workflows/release_process_backports.yaml | |
| with: | |
| issue: ${{ needs.parse_comment.outputs.issue_number }} | |
| add_backports: ${{ needs.parse_comment.outputs.command == 'add-backports' && needs.parse_comment.outputs.backports || '' }} | |
| comment_id: "${{ github.event.comment.id }}" | |
| secrets: inherit | |
| call_promote: | |
| needs: parse_comment | |
| if: needs.parse_comment.outputs.command == 'promote' | |
| uses: ./.github/workflows/release_promote_rc.yaml | |
| with: | |
| issue: ${{ needs.parse_comment.outputs.issue_number }} | |
| secrets: inherit |