Skip to content

Commit

Permalink
fix(check-build): checkbuild should only add comments to PRs
Browse files Browse the repository at this point in the history
The `check-build` action attempts to create a comment letting people know that the build isn't
correct and what they need to do to correct it.  This ensures those steps do not run against pushes
into master.

fixes #16
  • Loading branch information
greenkiwi committed Feb 25, 2022
1 parent e176abd commit 2175c59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- uses: ./test
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

action-test:
name: Action test
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions check-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ runs:
fi
- name: Check for run instructions
uses: peter-evans/find-comment@v1
if: success() || failure()
if: github.event_name == 'pull_request' && (success() || failure())
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "npm run prepare"
- name: Create instructions comment
if: failure() && steps.fc.outputs.comment-id == ''
if: github.event_name == 'pull_request' && failure() && steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
Expand All @@ -47,7 +47,7 @@ runs:
```
This will add those changes to your last commit. Push that to your PR.
- name: Delete instructions comment
if: success() && steps.fc.outputs.comment-id != ''
if: github.event_name == 'pull_request' && success() && steps.fc.outputs.comment-id != ''
uses: jungwinter/comment@v1
with:
type: delete
Expand Down

0 comments on commit 2175c59

Please sign in to comment.