Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment checkdiff output on PRs #1548

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/checkdiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on: pull_request

jobs:
checkdiff:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Set up repo
Expand All @@ -12,6 +14,17 @@ jobs:
git remote add upstream "${{ github.event.pull_request.base.repo.clone_url }}"
git fetch upstream
- name: Checkdiff
id: checkdiff
working-directory: rgbds
run: |
make checkdiff "BASE_REF=${{ github.event.pull_request.base.sha }}" Q= | tee log
make checkdiff "BASE_REF=${{ github.event.pull_request.base.sha }}" | tee log
- name: Comment
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `**Checkdiff:** <pre><code>${{steps.checkdiff.outputs.response}}</code></pre>`
})
Comment on lines +20 to +30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
make checkdiff "BASE_REF=${{ github.event.pull_request.base.sha }}" | tee log
- name: Comment
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `**Checkdiff:** <pre><code>${{steps.checkdiff.outputs.response}}</code></pre>`
})
make checkdiff "BASE_REF=${{ github.event.pull_request.base.sha }}"
- name: Comment
if: ${{ failure() && steps.checkdiff.conclusion == 'failure' }} # Only create the review if `checkdiff` found some errors.
uses: actions/github-script@v7
with:
script: |
github.rest.pulls.createReview({
pull_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `**Checkdiff:** <pre><code>${{ steps.checkdiff.outputs.response }}</code></pre>`,
event: "REQUEST_CHANGES",
})

...and we'd make checkdiff return a non-zero error status if any checks fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think checkdiff should ever fail that way: false positives are expected sometimes, and CI as a whole shouldn't be marked as ❌ just because of that.

Loading