Skip to content

Commit

Permalink
Fix ecosystem check bug where comment is no longer updated (#8446)
Browse files Browse the repository at this point in the history
Instead, a second is posted
  • Loading branch information
zanieb authored Nov 2, 2023
1 parent 0d93fbb commit 7dd5137
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/pr-comment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR Check Comment
name: Ecosystem check comment

on:
workflow_run:
Expand All @@ -18,13 +18,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: dawidd6/action-download-artifact@v2
name: Download PR Number
name: Download pull request number
with:
name: pr-number
run_id: ${{ github.event.workflow_run.id || github.event.inputs.workflow_run_id }}
if_no_artifact_found: ignore

- name: Extract PR Number
- name: Parse pull request number
id: pr-number
run: |
if [[ -f pr-number ]]
Expand All @@ -33,7 +33,7 @@ jobs:
fi
- uses: dawidd6/action-download-artifact@v2
name: "Download Ecosystem Result"
name: "Download ecosystem results"
id: download-ecosystem-result
if: steps.pr-number.outputs.pr-number
with:
Expand All @@ -44,10 +44,14 @@ jobs:
workflow_conclusion: completed
if_no_artifact_found: ignore

- name: Generate Comment
- name: Generate comment content
id: generate-comment
if: steps.download-ecosystem-result.outputs.found_artifact == 'true'
run: |
# Note this identifier is used to find the comment to update on
# subsequent runs
echo '<!-- generated-comment ecosystem -->' >> comment.txt
echo '## `ruff-ecosystem` results' >> comment.txt
cat pr/ecosystem/ecosystem-result >> comment.txt
echo "" >> comment.txt
Expand All @@ -56,14 +60,14 @@ jobs:
cat comment.txt >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Find Comment
- name: Find existing comment
uses: peter-evans/find-comment@v2
if: steps.generate-comment.outcome == 'success'
id: find-comment
with:
issue-number: ${{ steps.pr-number.outputs.pr-number }}
comment-author: "github-actions[bot]"
body-includes: PR Check Results
body-includes: "<!-- generated-comment ecosystem -->"

- name: Create or update comment
if: steps.find-comment.outcome == 'success'
Expand Down

0 comments on commit 7dd5137

Please sign in to comment.