From d5f590b5692cd507ab327e8e514647ae9e7ee68f Mon Sep 17 00:00:00 2001 From: Defelo Date: Wed, 13 Aug 2025 13:59:44 +0200 Subject: [PATCH] feat: mark pr as ready for review on success --- .github/workflows/review.yml | 12 ++++++++++++ README.md | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 8e5f501..d8728f3 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -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: | diff --git a/README.md b/README.md index 2fe9608..669289c 100644 --- a/README.md +++ b/README.md @@ -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 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.