https://github.com/cloudforet-io/check-pr-action
Check Pull Request by Github Action
https://github.com/cloudforet-io/check-pr-action
common
Last synced: about 1 year ago
JSON representation
Check Pull Request by Github Action
- Host: GitHub
- URL: https://github.com/cloudforet-io/check-pr-action
- Owner: cloudforet-io
- License: mit
- Created: 2024-03-21T11:09:12.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-02T20:14:22.000Z (almost 2 years ago)
- Last Synced: 2025-02-04T11:52:00.946Z (over 1 year ago)
- Topics: common
- Language: JavaScript
- Homepage:
- Size: 715 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Check signed-off-by in PR
[](https://github.com/super-linter/super-linter)

A Github Action that checks the commits of the current PR and fails if it contains unsigned commits.
It places a comment on the PR with the result of the check. It also add labels ***pass/signedoff*** to the PR.
## Usage
```
# .github/workflows/check-pull-request.yml
name: Check Pull Request
on:
pull_request_target:
jobs:
check-pull-request:
name: Check Pull Request
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check signed commits
id: review
uses: cloudforet-io/check-pr-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Result
if: ${{ steps.review.outputs.signedoff == 'false' }}
run: |
echo "The review result is ${{ steps.review.outputs.signedoff }}"
exit 1
```
## Outputs
| variable | description |
| --- | --- |
| signedoff | true or false |

## More information
The reason to prefer **pull_request_target** over **pull_request** is that **pull_request_target** allows the action to run with the permissions of the user who opened the PR, which is necessary to add a comment to the PR.
The Github token that comes with **pull_request** event does not have the necessary permissions to add a comment to the PR.
```
on:
pull_request_target:
jobs:
...
permissions:
pull-requests: write
```