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>
This commit is contained in:
31
.github/workflows/blocked-prs.yml
vendored
31
.github/workflows/blocked-prs.yml
vendored
@@ -27,11 +27,6 @@ jobs:
|
||||
app-id: ${{ vars.PULL_REQUEST_APP_ID }}
|
||||
private-key: ${{ secrets.PULL_REQUEST_APP_PRIVATE_KEY }}
|
||||
|
||||
- name: Checkout Default Branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.repository.default_branch }}
|
||||
|
||||
- name: Setup From Dispatch Event
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
id: dispatch_event_setup
|
||||
@@ -198,15 +193,14 @@ jobs:
|
||||
done < <(jq -c '.[]' <<< "$BLOCKING_DATA")
|
||||
|
||||
- name: Context Comment
|
||||
id: blocked_comment
|
||||
id: generate-comment
|
||||
if: fromJSON(steps.pr_ids.outputs.prs).numBlocking > 0
|
||||
continue-on-error: true
|
||||
env:
|
||||
BLOCKING_DATA: ${{ steps.blocking_data.outputs.data }}
|
||||
run: |
|
||||
COMMENT_PATH="$(pwd)/temp_comment_file.txt"
|
||||
touch "$COMMENT_PATH"
|
||||
echo "" > "$COMMENT_PATH"
|
||||
echo '<h3> PR Dependencies :pushpin:</h3>' > "$COMMENT_PATH"
|
||||
pr_head_label=$(jq -r '.prHeadLabel' <<< "$JOB_DATA")
|
||||
while read -r pr_data ; do
|
||||
base_pr=$(jq -r '.number' <<< "$pr_data")
|
||||
@@ -218,17 +212,20 @@ jobs:
|
||||
type=$(jq -r '.type' <<< "$pr_data")
|
||||
echo " - $type #$base_pr $status [(compare)]($compare_url)" >> "$COMMENT_PATH"
|
||||
done < <(jq -c '.[]' <<< "$BLOCKING_DATA")
|
||||
echo "file_path=${COMMENT_PATH}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
echo 'body<<EOF' >> "$GITHUB_OUTPUT"
|
||||
cat "${COMMENT_PATH}" >> "$GITHUB_OUTPUT"
|
||||
echo 'EOF' >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: 💬 PR Comment
|
||||
if: fromJSON(steps.pr_ids.outputs.prs).numBlocking > 0
|
||||
continue-on-error: true
|
||||
uses: ./.github/actions/create-comment
|
||||
with:
|
||||
comment: "<h3> PR Dependencies :pushpin:</h3>"
|
||||
comment_path: ${{ steps.blocked_comment.outputs.file_path }}
|
||||
comment_id: "block_pr_dependencies"
|
||||
issue_number: ${{ env.PR_NUMBER }}
|
||||
repository: ${{ github.repository }}
|
||||
gh_token: ${{ steps.generate-token.outputs.token }}
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
COMMENT_BODY: ${{ steps.generate-comment.outputs.body }}
|
||||
run: |
|
||||
gh -R ${{ github.repository }} issue comment "$PR_NUMBER" \
|
||||
--body "$COMMENT_BODY" \
|
||||
--create-if-none \
|
||||
--edit-last
|
||||
|
||||
|
||||
Reference in New Issue
Block a user