|
30 | 30 | uses: actions/checkout@v4 |
31 | 31 | with: |
32 | 32 | ref: ${{ github.event.repository.default_branch }} |
33 | | - - name: Setup From Pull Request Event |
34 | | - if: github.event_name != 'workflow_dispatch' |
35 | | - id: pr_event_setup |
36 | | - env: |
37 | | - PR_JSON: "${{ toJSON(github.event.pull_request) }}" |
38 | | - run: | |
39 | | - # setup env for the rest of the workflow |
40 | | - { |
41 | | - echo "REPO=$(jq -r '.base.repo.name' <<< "$PR_JSON")" |
42 | | - echo "OWNER=$(jq -r '.base.repo.owner.login' <<< "$PR_JSON")" |
43 | | - echo "PR_NUMBER=$(jq -r '.number' <<< "$PR_JSON")" |
44 | | - echo "JOB_DATA=$(jq -c ' |
45 | | - { |
46 | | - "repo": .base.repo.name, |
47 | | - "owner": .base.repo.owner.login, |
48 | | - "repoUrl": .base.repo.html_url, |
49 | | - "prNumber": .number, |
50 | | - "prHeadSha": .head.sha, |
51 | | - "prHeadLabel": .head.label, |
52 | | - "prBody": .body, |
53 | | - "prLabels": (reduce .labels[].name as $l ([]; . + [$l])) |
54 | | - } |
55 | | - ' <<< "$PR_JSON")" |
56 | | - } >> "$GITHUB_ENV" |
57 | 33 |
|
58 | 34 | - name: Setup From Dispatch Event |
59 | 35 | if: github.event_name == 'workflow_dispatch' |
|
71 | 47 | -H "X-GitHub-Api-Version: 2022-11-28" \ |
72 | 48 | "/repos/$OWNER/$REPO/pulls/$PR_NUMBER" |
73 | 49 | ) |
| 50 | + echo "PR_JSON=$PR_JSON" >> "$GITHUB_ENV" |
| 51 | +
|
| 52 | + - name: Setup Environment |
| 53 | + id: env_setup |
| 54 | + run: | |
| 55 | + # setup env for the rest of the workflow |
| 56 | + PR_JSON=${PR_JSON:-'${{ toJSON(github.event.pull_request) }}'} |
74 | 57 | { |
75 | 58 | echo "REPO=$(jq -r '.base.repo.name' <<< "$PR_JSON")" |
76 | 59 | echo "OWNER=$(jq -r '.base.repo.owner.login' <<< "$PR_JSON")" |
|
89 | 72 | ' <<< "$PR_JSON")" |
90 | 73 | } >> "$GITHUB_ENV" |
91 | 74 |
|
| 75 | +
|
92 | 76 | - name: Find Blocked/Stacked PRs in body |
93 | 77 | id: pr_ids |
94 | 78 | run: | |
@@ -160,7 +144,7 @@ jobs: |
160 | 144 |
|
161 | 145 | - name: Add 'blocked' Label is Missing |
162 | 146 | id: label_blocked |
163 | | - if: fromJSON(steps.pr_ids.outputs.prs).numBlocking > 0 && && !contains(fromJSON(env.JOB_DATA).prLabels, 'blocked') && !fromJSON(steps.blocking_data.outputs.all_merged) |
| 147 | + if: (fromJSON(steps.pr_ids.outputs.prs).numBlocking > 0) && !contains(fromJSON(env.JOB_DATA).prLabels, 'blocked') && !fromJSON(steps.blocking_data.outputs.all_merged) |
164 | 148 | continue-on-error: true |
165 | 149 | env: |
166 | 150 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
0 commit comments