From f7790698b7b8269bdb71829fe52a0882f1276b9e Mon Sep 17 00:00:00 2001 From: Zanie Date: Wed, 25 Oct 2023 14:50:29 -0500 Subject: [PATCH] Tweak pull request comment --- .github/workflows/ci.yaml | 20 ++++++------ .github/workflows/pr-comment.yaml | 51 ++++++++++++++++++++++--------- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 17dc31df1e..d72b903542 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -213,8 +213,6 @@ jobs: ruff-ecosystem check $(which ruff) ./ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-check cat ecosystem-result-check > $GITHUB_STEP_SUMMARY - echo ${{ github.event.number }} > pr-number - - name: Run `ruff format` ecosystem check # if: ${{ needs.determine_changes.outputs.formatter == 'true' }} TMP run: | @@ -224,12 +222,9 @@ jobs: ruff-ecosystem format $(which ruff) ./ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-format cat ecosystem-result-format > $GITHUB_STEP_SUMMARY - echo ${{ github.event.number }} > pr-number - - - name: Combine ecosystem check results - # if: ${{ needs.determine_changes.outputs.formatter == 'true' }} TMP + - name: Export pull request number run: | - cat ecosystem-result-check ecosystem-result-format > ecosystem-result + echo ${{ github.event.number }} > pr-number - uses: actions/upload-artifact@v3 name: Upload PR Number @@ -240,8 +235,15 @@ jobs: - uses: actions/upload-artifact@v3 name: Upload Results with: - name: ecosystem-result - path: ecosystem-result + name: ecosystem-result-check + path: ecosystem-result-check + + - uses: actions/upload-artifact@v3 + name: Upload Results + with: + name: ecosystem-result-format + path: ecosystem-result-format + # cargo-udeps: # name: "cargo udeps" diff --git a/.github/workflows/pr-comment.yaml b/.github/workflows/pr-comment.yaml index a556d5a941..bc8ce8e898 100644 --- a/.github/workflows/pr-comment.yaml +++ b/.github/workflows/pr-comment.yaml @@ -33,33 +33,54 @@ jobs: fi - uses: dawidd6/action-download-artifact@v2 - name: "Download Ecosystem Result" - id: download-ecosystem-result + name: "Download ecosystem result for `check`" + id: download-ecosystem-result-check if: steps.pr-number.outputs.pr-number with: - name: ecosystem-result + name: ecosystem-result-check workflow: ci.yaml pr: ${{ steps.pr-number.outputs.pr-number }} - path: pr/ecosystem + path: pr/ecosystem-check if_no_artifact_found: ignore - - name: Generate Comment - id: generate-comment - if: steps.download-ecosystem-result.outputs.found_artifact == 'true' + - uses: dawidd6/action-download-artifact@v2 + name: "Download ecosystem result for `format`" + id: download-ecosystem-result-format + if: steps.pr-number.outputs.pr-number + with: + name: ecosystem-result-format + workflow: ci.yaml + pr: ${{ steps.pr-number.outputs.pr-number }} + path: pr/ecosystem-format + if_no_artifact_found: ignore + + - name: Generate `check` ecosystem comment + if: steps.download-ecosystem-result-check.outputs.found_artifact == 'true' run: | - echo '## PR Check Results' >> comment.txt + echo "## Ecosystem results `ruff check`" >> comment.txt + cat pr/ecosystem/ecosystem-result-check >> comment.txt + echo "
" >> comment.txt - echo "### Ecosystem" >> comment.txt - cat pr/ecosystem/ecosystem-result >> comment.txt - echo "" >> comment.txt + - name: Generate `format` ecosystem comment + if: steps.download-ecosystem-result-format.outputs.found_artifact == 'true' + run: | + echo "## Ecosystem results `ruff format`" >> comment.txt + cat pr/ecosystem/ecosystem-result-format >> comment.txt + echo "
" >> comment.txt - echo 'comment<> $GITHUB_OUTPUT - cat comment.txt >> $GITHUB_OUTPUT - echo 'EOF' >> $GITHUB_OUTPUT + - name: Check comment + run: | + echo $(test -f comment.txt) >> $GITHUB_OUTPUT + + # - name: Generate GitHub output + # run: | + # echo 'comment<> $GITHUB_OUTPUT + # cat comment.txt >> $GITHUB_OUTPUT + # echo 'EOF' >> $GITHUB_OUTPUT - name: Find Comment uses: peter-evans/find-comment@v2 - if: steps.generate-comment.outcome == 'success' + if: ${{ steps.check-comment.outputs == 'true' }} id: find-comment with: issue-number: ${{ steps.pr-number.outputs.pr-number }}