Skip to content

Release 2.2.0

Release 2.2.0 #6

Workflow file for this run

name: "On 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.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR'
outputs:
command: ${{ steps.parse.outputs.command }}
issue_number: ${{ steps.parse.outputs.issue_number }}
pr_number: ${{ steps.parse.outputs.pr_number }}
backports: ${{ steps.parse.outputs.backports }}
steps:
- name: Parse comment
id: parse
env:
COMMENT_BODY: ${{ github.event.comment.body }}
IS_PR: "${{ github.event.issue.pull_request != null }}"
EVENT_NUMBER: "${{ github.event.issue.number }}"
HAS_RELEASE_LABEL: "${{ contains(github.event.issue.labels.*.name, 'type: release') }}"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "$IS_PR" = "false" ] && [ "$HAS_RELEASE_LABEL" = "true" ]; then
issue_number=$EVENT_NUMBER
if echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/create-rc([[:space:]]|$)'; then
echo "command=create-rc" >> "$GITHUB_OUTPUT"
echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT"
elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/prepare([[:space:]]|$)'; then
echo "command=prepare" >> "$GITHUB_OUTPUT"
echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT"
elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/process-backports([[:space:]]|$)'; then
echo "command=process-backports" >> "$GITHUB_OUTPUT"
echo "issue_number=$issue_number" >> "$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:]]*//')
args=$(echo "$args" | sed -e 's/^[[:space:],]*//' -e 's/[[:space:],]*$//')
csv=$(echo "$args" | sed -E 's/[[:space:],]+/ /g' | tr ' ' ',')
if [ -n "$csv" ]; then
echo "command=add-backports" >> "$GITHUB_OUTPUT"
echo "backports=$csv" >> "$GITHUB_OUTPUT"
echo "issue_number=$issue_number" >> "$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"
echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT"
else
echo "command=none" >> "$GITHUB_OUTPUT"
fi
elif [ "$IS_PR" = "true" ]; then
pr_number=$EVENT_NUMBER
if echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/backport([[:space:]]|$)'; then
echo "command=pr-backport" >> "$GITHUB_OUTPUT"
echo "pr_number=$pr_number" >> "$GITHUB_OUTPUT"
else
echo "command=none" >> "$GITHUB_OUTPUT"
fi
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 }}
comment_id: "${{ github.event.comment.id }}"
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_add_backports:
needs: parse_comment
if: |
needs.parse_comment.outputs.command == 'add-backports' ||
needs.parse_comment.outputs.command == 'pr-backport'
uses: ./.github/workflows/release_add_backports.yaml
with:
prs: ${{ needs.parse_comment.outputs.command == 'pr-backport' && needs.parse_comment.outputs.pr_number || needs.parse_comment.outputs.backports }}
issue: ${{ needs.parse_comment.outputs.issue_number }}
secrets: inherit
call_process_backports_after_add:
needs: [parse_comment, call_add_backports]
if: needs.parse_comment.outputs.command == 'add-backports'
uses: ./.github/workflows/release_process_backports.yaml
with:
issue: ${{ needs.parse_comment.outputs.issue_number }}
comment_id: "${{ github.event.comment.id }}"
secrets: inherit
call_process_backports_only:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'process-backports'
uses: ./.github/workflows/release_process_backports.yaml
with:
issue: ${{ needs.parse_comment.outputs.issue_number }}
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