Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hatemhosny/gh-action-example2
https://github.com/hatemhosny/gh-action-example2
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hatemhosny/gh-action-example2
- Owner: hatemhosny
- License: mit
- Created: 2024-01-31T17:31:11.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-02-01T12:46:18.000Z (10 months ago)
- Last Synced: 2024-05-01T17:30:33.491Z (7 months ago)
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Post PR Comment from Artifact
This GitHub Action allows you to post a pull request comment from an artifact.
The artifact is downloaded, extracted and the first file in it is used for the comment. The file name is used as the pull request number (excluding the file extension), while the content of the file is used as the comment body.
"Upsert" mode is used for multiple comments to the same pull request (the comment is updated if it already exists).
Typically, this action is used in conjunction with a workflow that creates an artifact, and is triggered by a successful workflow run (see usage below).
## Inputs
- `GITHUB_TOKEN`: Github token of the repository - (default: `${{ github.token }}` [automatically created by Github])
- `artifact`: Name of the artifact - (default: "pr")## Outputs
- `id`: ID of the comment
- `body`: Body of the comment
- `html_url`: HTML URL of the comment## Usage
```yaml
name: Comment on pull requeston:
workflow_run:
workflows: ["create-artifact"] # the workflow that created the artifact
types:
- completedjobs:
upload:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'steps:
- name: Post comment
uses: hatemhosny/gh-action-example2@main
with:
GITHUB_TOKEN: ${{ github.token }}
```## Credits
Based on:
- https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
- https://github.com/thollander/actions-comment-pull-request## License
MIT License