Skip to content

Commit 436896d

Browse files
committed
ci(blocked-pr): use gh issue comment --create-if-none --edit-last with app token, not composit action
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
1 parent 187728c commit 436896d

File tree

2 files changed

+14
-172
lines changed

2 files changed

+14
-172
lines changed

.github/actions/create-comment/action.yml

Lines changed: 0 additions & 155 deletions
This file was deleted.

.github/workflows/blocked-prs.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ jobs:
2727
app-id: ${{ vars.PULL_REQUEST_APP_ID }}
2828
private-key: ${{ secrets.PULL_REQUEST_APP_PRIVATE_KEY }}
2929

30-
- name: Checkout Default Branch
31-
uses: actions/checkout@v4
32-
with:
33-
ref: ${{ github.event.repository.default_branch }}
34-
3530
- name: Setup From Dispatch Event
3631
if: github.event_name == 'workflow_dispatch'
3732
id: dispatch_event_setup
@@ -198,15 +193,14 @@ jobs:
198193
done < <(jq -c '.[]' <<< "$BLOCKING_DATA")
199194
200195
- name: Context Comment
201-
id: blocked_comment
196+
id: generate-comment
202197
if: fromJSON(steps.pr_ids.outputs.prs).numBlocking > 0
203198
continue-on-error: true
204199
env:
205200
BLOCKING_DATA: ${{ steps.blocking_data.outputs.data }}
206201
run: |
207202
COMMENT_PATH="$(pwd)/temp_comment_file.txt"
208-
touch "$COMMENT_PATH"
209-
echo "" > "$COMMENT_PATH"
203+
echo '<h3> PR Dependencies :pushpin:</h3>' > "$COMMENT_PATH"
210204
pr_head_label=$(jq -r '.prHeadLabel' <<< "$JOB_DATA")
211205
while read -r pr_data ; do
212206
base_pr=$(jq -r '.number' <<< "$pr_data")
@@ -218,17 +212,20 @@ jobs:
218212
type=$(jq -r '.type' <<< "$pr_data")
219213
echo " - $type #$base_pr $status [(compare)]($compare_url)" >> "$COMMENT_PATH"
220214
done < <(jq -c '.[]' <<< "$BLOCKING_DATA")
221-
echo "file_path=${COMMENT_PATH}" >> "$GITHUB_OUTPUT"
215+
216+
echo 'body<<EOF' >> "$GITHUB_OUTPUT"
217+
cat "${COMMENT_PATH}" >> "$GITHUB_OUTPUT"
218+
echo 'EOF' >> "$GITHUB_OUTPUT"
222219
223220
- name: 💬 PR Comment
224221
if: fromJSON(steps.pr_ids.outputs.prs).numBlocking > 0
225222
continue-on-error: true
226-
uses: ./.github/actions/create-comment
227-
with:
228-
comment: "<h3> PR Dependencies :pushpin:</h3>"
229-
comment_path: ${{ steps.blocked_comment.outputs.file_path }}
230-
comment_id: "block_pr_dependencies"
231-
issue_number: ${{ env.PR_NUMBER }}
232-
repository: ${{ github.repository }}
233-
gh_token: ${{ steps.generate-token.outputs.token }}
223+
env:
224+
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
225+
COMMENT_BODY: ${{ steps.generate-comment.outputs.body }}
226+
run: |
227+
gh -R ${{ github.repository }} issue comment "$PR_NUMBER" \
228+
--body "$COMMENT_BODY" \
229+
--create-if-none \
230+
--edit-last
234231

0 commit comments

Comments
 (0)