feat: mark pr as ready for review on success

This commit is contained in:
Defelo 2025-08-13 13:59:44 +02:00
commit d5f590b569
No known key found for this signature in database
GPG key ID: 2A05272471204DD3
2 changed files with 14 additions and 2 deletions

View file

@ -69,6 +69,7 @@ on:
default: nothing
options:
- nothing
- mark_as_ready
- approve
- merge
@ -347,6 +348,17 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: mark pull request as ready for review
if: ${{ needs.report.outputs.success == 'true' && inputs.on-success == 'mark_as_ready' }}
run: |
if [[ -z "$GH_TOKEN" ]]; then
echo "::error::Cannot mark the PR as ready for review because no GH_TOKEN has been configured."
exit 1
fi
gh pr -R NixOS/nixpkgs ready ${PR_NUMBER}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: approve pull request
if: ${{ needs.report.outputs.success == 'true' && (inputs.on-success == 'approve' || inputs.on-success == 'merge') }}
run: |

View file

@ -8,7 +8,7 @@ Run [nixpkgs-review](https://github.com/Mic92/nixpkgs-review) in GitHub Actions
- Automatically post results on the reviewed pull request
- Optionally start an [Upterm](https://upterm.dev/) session after nixpkgs-review has finished to allow interactive testing/debugging via SSH
- Push new packages to an [Attic](https://github.com/zhaofengli/attic) or [Cachix](https://www.cachix.org/) cache
- After a successful review, automatically approve the PR or merge it (directly or via the [nixpkgs-merge-bot](https://github.com/NixOS/nixpkgs-merge-bot))
- After a successful review, automatically mark the PR as ready for review, approve it, or merge it (directly or via the [nixpkgs-merge-bot](https://github.com/NixOS/nixpkgs-merge-bot))
- Add a "Run nixpkgs-review" shortcut to pull request pages in nixpkgs
## Setup
@ -17,7 +17,7 @@ Run [nixpkgs-review](https://github.com/Mic92/nixpkgs-review) in GitHub Actions
3. If you don't want to set up [automatic self-updates](#automatic-self-updates-optional), please disable the `self-update` workflow ([Actions / `self-update`](../../actions/workflows/self-update.yml) > `...` button (top right corner) > `Disable workflow`).
### Post Results / Auto Approve/Merge (optional)
If you want nixpkgs-review-gha to automatically post the results on the reviewed pull requests or automatically approve/merge them, you need to generate a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens):
If you want nixpkgs-review-gha to automatically post the results on the reviewed pull requests or automatically mark them as ready for review or approve/merge them, you need to generate a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens):
1. Go to <https://github.com/settings/tokens> and generate a new **classic** token with the `public_repo` scope.
2. In your fork, go to "Settings" > "Secrets and variables" > "Actions" and [add a new repository secret](../../settings/secrets/actions/new) with the name `GH_TOKEN` and set its value to the personal access token you generated before.