https://github.com/elilillyco/github-actions-post-to-pr
Github Actions Post to Pull Request with Previous Build Result Comparison
https://github.com/elilillyco/github-actions-post-to-pr
actions github node
Last synced: 10 months ago
JSON representation
Github Actions Post to Pull Request with Previous Build Result Comparison
- Host: GitHub
- URL: https://github.com/elilillyco/github-actions-post-to-pr
- Owner: EliLillyCo
- License: mit
- Created: 2020-05-14T13:20:02.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-18T19:17:04.000Z (11 months ago)
- Last Synced: 2025-03-06T14:21:37.341Z (11 months ago)
- Topics: actions, github, node
- Language: JavaScript
- Homepage:
- Size: 1.92 MB
- Stars: 6
- Watchers: 18
- Forks: 6
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Github Actions Post to Pull Request
This github actions allows easy posting of formatted build results into GitHub PRs.
## Setup
Durring the github action build, create a build output text file.
```
your build command | tee output.txt
```
Inlcude the Post to PR github action step.
```
- name: "Post to PR"
uses: EliLillyCo/github-actions-post-to-pr@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
post_to_pr_definition: |
[
{
"message_file": "./output.txt",
"title": "My Test Execution"
}
]
```
This will create a pull request comment such as the one below.
Additional optional arguments are available to customize the pull request output
```
[
{
"message_file": "./output.txt",
"title": "My Test Execution",
"artifact_name": "defaults to title", // OPTIONAL: Defaults to title stripped of non-alphanumeric characters/spaces
"modifier": "grep 'onlytheselines'", // OPTIONAL: Shell command which will be executed against the output file. This can be used to prevent long pull request messages.
"collapsible": true // OPTIONAL: true/false, set to true to make PR message collapse for long messages, defaults to False
}
]
```
# --- Example Pull Request Comment ---
# Unit Test
## This change:
```
> post-to-pr@0.0.1 test /home/runner/work/github-actions-post-to-pr/github-actions-post-to-pr
> eslint *.js && jest --collect-coverage
-----------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-----------------|----------|----------|----------|----------|-------------------|
All files | 94.94 | 86.36 | 90.91 | 94.94 | |
pull_request.js | 96.36 | 85 | 100 | 96.36 | 21,40 |
utils.js | 91.67 | 100 | 83.33 | 91.67 | 42,44 |
-----------------|----------|----------|----------|----------|-------------------|
```
# Contributing
Pull requests & issues welcome!
## Dev Setup
## Setup Dependencies
```
npm install
```
## Running tests
```
npm test
```
## Packaging (required before creating PR)
```
npm run package
```