Skip to content

Commit

Permalink
first pass at trying to get failed rustfmt summary as comment
Browse files Browse the repository at this point in the history
  • Loading branch information
amika-sq committed Dec 1, 2023
1 parent 8a30609 commit 4e01d04
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
format:
name: cargo fmt
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Setup Rustfmt
Expand All @@ -39,3 +42,20 @@ jobs:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
- name: Save Failure Summary (if needed)
if: failure()
run: echo "$GITHUB_STEP_SUMMARY" > summary.md
- name: Comment Failure Summary (if needed)
if: failure() && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const summary = fs.readFileSync('summary.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});

0 comments on commit 4e01d04

Please sign in to comment.