https://github.com/philips-software/pull-request-report-action
GitHub action to collect Pull Request related Data and attached that as report to a Pull Request when it's merged.
https://github.com/philips-software/pull-request-report-action
action pr pull-request report
Last synced: 8 months ago
JSON representation
GitHub action to collect Pull Request related Data and attached that as report to a Pull Request when it's merged.
- Host: GitHub
- URL: https://github.com/philips-software/pull-request-report-action
- Owner: philips-software
- License: mit
- Created: 2023-05-09T14:25:48.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-09T08:10:04.000Z (9 months ago)
- Last Synced: 2025-04-09T08:37:31.007Z (9 months ago)
- Topics: action, pr, pull-request, report
- Language: TypeScript
- Size: 2.41 MB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Pull Request Report Action [](https://github.com/philips-software/pull-request-report-action/actions/workflows/typescript-gate.yml)
## Features
- Reading and generate some basic PR measures from every merged PR
- Provide these measures as a comment on the merged PR
- Provide the raw measures as a hidden JSON data in comment
- Get a path to a json file with the raw data for further processing
More features are planned for the future. If you have any suggestions, please
open an issue or create a PR.
## Getting Started
Like all other actions in GitHub, these are referenced in your workflow files
and run on GitHub runners or self-hosted GitHub runners. As an example, let's
create a workflow file that is triggered by closing a PR.
Create a workflow file in your repository at e.g.
`.github/workflows/pr-report.yaml` with the following content:
```yaml
name: Add Pull Request Report to PR when closed
on:
pull_request:
# only run when PR is closed
types: [closed]
# token needs some additional permissions to be able to add a comment to the PR
# and read all PR data
# permissions can vary depending on the metrics you want to use and org settings
permissions:
contents: read
checks: read
pull-requests: write
repository-projects: read
actions: read
jobs:
add-pr-report-as-comment:
runs-on: ubuntu-latest
name: Generate report and add it as comment to the PR
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Generate PR report
id: generate_report
uses: philips-software/pull-request-report-action@6d08a2c0a96d666770637b54e050d6512e9d45b0 # v0.1.2
with:
ShowNumberOfChangedFiles: 'no'
ShowTimeToMergeAfterLastReview: 'no'
env:
GITHUB_TOKEN: ${{ github.token }}
# Instead of printing the path to the console you can upload the file
# with curl to a central service to collect all the data for further
# processing
- name: Print path of raw data json file
run: echo "Report path: ${{ steps.generate_report.outputs.json_report_path }}"
```
**Note**
The referenced actions are pinned to a specific commit. This is to ensure that
the action is not changed without you knowing. You can find the latest commit
for each action in the Release notes of the action. Use dependabot to keep your
actions up to date. Dependabot will take care of updating the commit hash for
you. See [Dependabot for GitHub Actions](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot).
### Configuration
At the moment, the configuration of the action is limited to the individual
metrics. In the example above we see that we do not want to see the two metrics
`ShowNumberOfChangedFiles` and `ShowTimeToMergeAfterLastReview` in the pull
request report.
With more features, the configuration options will also increase.
The overview of all metrics and their default values can be found in the
[metrics documentation](./config.md).
Besides the configuration settings the action also returns an output value as
you can see in the [`action.yml`](./action.yml). The name of the variable is
`json_report_path` and contains the path to the file with the raw data of the
pull request. This can be especially useful if the data is to be stored or
analyzed centrally.