Skip to content

Commit

Permalink
Merge branch 'master' into gaction_freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-m-leonard committed Apr 29, 2024
2 parents f557f42 + 1272692 commit 3e7c5e8
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/code-freeze-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,31 @@ jobs:
echo "Getting target branch"
TARGET_BRANCH="$(gh pr view "$PR_NUMBER" --repo "$REPOSITORY" --json baseRefName --jq '.baseRefName')"
echo "pr_target_branch=$TARGET_BRANCH" >> "$GITHUB_OUTPUT"
echo "PR target branch = $TARGET_BRANCH"
env:
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Filter target branch to code freeze branches
- name: Check if target branch is a code freeze branch
if: github.event_name == 'pull_request_target' || (github.event_name == 'issue_comment' && github.event.issue.pull_request)
id: filter-branch
id: check-freeze-branch
# Following grep "regex" needs to exactly match the required target branches to "freeze"
run: |
FILTERED_BRANCH="$(echo "$PR_TARGET_BRANCH" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$')"
echo "filtered_code_freeze_branch=$FILTERED_BRANCH" >> "$GITHUB_OUTPUT"
if echo "$PR_TARGET_BRANCH" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
FREEZE_BRANCH='true'
else
FREEZE_BRANCH='false'
fi
echo "code_freeze_branch=$FREEZE_BRANCH" >> "$GITHUB_OUTPUT"
echo "Is $PR_TARGET_BRANCH a code freeze branch? => $FREEZE_BRANCH"
env:
PR_TARGET_BRANCH: $${{ steps.get-pr-target-branch.outputs.pr_target_branch }}
PR_TARGET_BRANCH: ${{ steps.get-pr-target-branch.outputs.pr_target_branch }}

- name: Code Freeze New
if: (github.event_name == 'pull_request_target' || (github.event_name == 'issue_comment' && github.event.issue.pull_request)) && steps.filter-branch.outputs.filtered_code_freeze_branch == steps.get-pr-target-branch.outputs.pr_target_branch
if: (github.event_name == 'pull_request_target' || (github.event_name == 'issue_comment' && github.event.issue.pull_request)) && steps.check-freeze-branch.outputs.code_freeze_branch == 'true'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
issue-number: ${{ github.event.issue.number }}
body: echo "CODE_FREEZE ${{ github.event.issue.number }}"
body: echo "IS CODE_FREEZE ${{ github.event.issue.number }}"

0 comments on commit 3e7c5e8

Please sign in to comment.