Skip to content

Commit 815306f

Browse files
Ryexgetchoo
andauthored
Use group redirections for multiple outputs, prevent glob expansion of PR_NUMBER
Co-authored-by: Seth Flynn <getchoo@tuta.io> Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
1 parent 436896d commit 815306f

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

.github/workflows/blocked-prs.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ jobs:
134134
'
135135
done < <(jq -c '.blocking[]' <<< "$BLOCKING_PRS") | jq -c -s
136136
)
137-
echo "data=$blocked_pr_data" >> "$GITHUB_OUTPUT"
138-
echo "all_merged=$(jq -r 'all(.[].merged; .)' <<< "$blocked_pr_data")" >> "$GITHUB_OUTPUT"
139-
echo "current_blocking=$(jq -c 'map( select( .merged | not ) | .number )' <<< "$blocked_pr_data" )" >> "$GITHUB_OUTPUT"
137+
{
138+
echo "data=$blocked_pr_data";
139+
echo "all_merged=$(jq -r 'all(.[].merged; .)' <<< "$blocked_pr_data")";
140+
echo "current_blocking=$(jq -c 'map( select( .merged | not ) | .number )' <<< "$blocked_pr_data" )";
141+
} >> "$GITHUB_OUTPUT"
140142
141143
- name: Add 'blocked' Label is Missing
142144
id: label_blocked
@@ -145,7 +147,7 @@ jobs:
145147
env:
146148
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
147149
run: |
148-
gh -R ${{ github.repository }} issue edit --add-label 'blocked' $PR_NUMBER
150+
gh -R ${{ github.repository }} issue edit --add-label 'blocked' "$PR_NUMBER"
149151
150152
- name: Remove 'blocked' Label if All Dependencies Are Merged
151153
id: unlabel_blocked
@@ -154,7 +156,7 @@ jobs:
154156
env:
155157
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
156158
run: |
157-
gh -R ${{ github.repository }} issue edit --remove-label 'blocked' $PR_NUMBER
159+
gh -R ${{ github.repository }} issue edit --remove-label 'blocked' "$PR_NUMBER"
158160
159161
- name: Apply 'blocking' Label to Unmerged Dependencies
160162
id: label_blocking
@@ -213,9 +215,11 @@ jobs:
213215
echo " - $type #$base_pr $status [(compare)]($compare_url)" >> "$COMMENT_PATH"
214216
done < <(jq -c '.[]' <<< "$BLOCKING_DATA")
215217
216-
echo 'body<<EOF' >> "$GITHUB_OUTPUT"
217-
cat "${COMMENT_PATH}" >> "$GITHUB_OUTPUT"
218-
echo 'EOF' >> "$GITHUB_OUTPUT"
218+
{
219+
echo 'body<<EOF';
220+
cat "${COMMENT_PATH}";
221+
echo 'EOF';
222+
} >> "$GITHUB_OUTPUT"
219223
220224
- name: 💬 PR Comment
221225
if: fromJSON(steps.pr_ids.outputs.prs).numBlocking > 0

.github/workflows/merge-blocking-pr.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ jobs:
3939
)) as $i ([]; . + [$i])
4040
'
4141
)
42-
echo "deps=$blocked_prs" >> "$GITHUB_OUTPUT"
43-
echo "numdeps=$(jq -r '. | length' <<< "$blocked_prs")" >> "$GITHUB_OUTPUT"
42+
{
43+
echo "deps=$blocked_prs"
44+
echo "numdeps=$(jq -r '. | length' <<< "$blocked_prs")"
45+
} >> "$GITHUB_OUTPUT"
4446
4547
- name: Trigger Blocked PR Workflows for Dependants
4648
if: fromJSON(steps.gather_deps.outputs.numdeps) > 0

0 commit comments

Comments
 (0)