From 9801aa7357083d789aa01cf3ef3ce62dab09448d Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Thu, 18 Apr 2024 06:58:59 +0200 Subject: [PATCH] Create Nixpkgs PRs with a separate workflow I didn't like how it would print for all PRs unnecessarily Furthermore it's cleaner if we trigger it based on when a release is published, instead of depending the build job --- .github/workflows/main.yml | 43 --------------------------------- .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 707626f..d2db5ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,46 +57,3 @@ jobs: } > $GITHUB_STEP_SUMMARY env: GH_TOKEN: ${{ github.token }} - - nixpkgs-pr: - runs-on: ubuntu-latest - if: ${{ github.event_name == 'push' }} - needs: build - steps: - - uses: actions/checkout@v4 - with: - repository: NixOS/nixpkgs - - - name: Update nixpkgs-check-by-name in Nixpkgs - run: | - echo "rev=$(git rev-parse HEAD)" >> $GITHUB_ENV - echo "before=$(> $GITHUB_ENV - - # We run bash explicitly instead of using the files shebang, - # because the shebang is using nix-shell with dependencies we already have by default - bash pkgs/test/check-by-name/update-pinned-tool.sh - - echo "after=$(> $GITHUB_ENV - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - # To trigger CI for automated PRs, we use a separate machine account - # See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs - # and https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#push-pull-request-branches-to-a-fork - token: ${{ secrets.MACHINE_USER_PAT }} - push-to-fork: infinixbot/nixpkgs - committer: infinixbot - author: infinixbot - branch: update/nixpkgs-check-by-name - commit-message: | - nixpkgs-check-by-name: ${{ env.before }} -> ${{ env.after }} - - https://github.com/NixOS/nixpkgs-check-by-name/releases/tag/${{ env.after }} - title: "nixpkgs-check-by-name: ${{ env.before }} -> ${{ env.after }}" - body: > - This is an automated PR to update the version of [nixpkgs-check-by-name](https://github.com/NixOS/nixpkgs-check-by-name), - which is used by CI to [check the `pkgs/by-name`](https://github.com/NixOS/nixpkgs/tree/${{ env.rev }}/pkgs/by-name#validation) directory. - The update was performed by running [`pkgs/test/check-by-name/update-pinned-tool.sh`](https://github.com/NixOS/nixpkgs/tree/${{ env.rev }}/pkgs/test/check-by-name#update-pinned-toolsh). - - This PR updates the tool to [version ${{ env.after }}](https://github.com/NixOS/nixpkgs-check-by-name/releases/tag/${{ env.after }}). diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0104a85 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +on: + release: + types: [published] + +jobs: + create-pr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + repository: NixOS/nixpkgs + + - name: Update nixpkgs-check-by-name in Nixpkgs + run: | + echo "rev=$(git rev-parse HEAD)" >> $GITHUB_ENV + echo "before=$(> $GITHUB_ENV + + # We run bash explicitly instead of using the files shebang, + # because the shebang is using nix-shell with dependencies we already have by default + bash pkgs/test/check-by-name/update-pinned-tool.sh + + echo "after=$(> $GITHUB_ENV + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + # To trigger CI for automated PRs, we use a separate machine account + # See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs + # and https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#push-pull-request-branches-to-a-fork + token: ${{ secrets.MACHINE_USER_PAT }} + push-to-fork: infinixbot/nixpkgs + committer: infinixbot + author: infinixbot + branch: update/nixpkgs-check-by-name + commit-message: | + nixpkgs-check-by-name: ${{ env.before }} -> ${{ env.after }} + + https://github.com/NixOS/nixpkgs-check-by-name/releases/tag/${{ env.after }} + title: "nixpkgs-check-by-name: ${{ env.before }} -> ${{ env.after }}" + body: > + This is an automated PR to update the version of [nixpkgs-check-by-name](https://github.com/NixOS/nixpkgs-check-by-name), + which is used by CI to [check the `pkgs/by-name`](https://github.com/NixOS/nixpkgs/tree/${{ env.rev }}/pkgs/by-name#validation) directory. + The update was performed by running [`pkgs/test/check-by-name/update-pinned-tool.sh`](https://github.com/NixOS/nixpkgs/tree/${{ env.rev }}/pkgs/test/check-by-name#update-pinned-toolsh). + + This PR updates the tool to [version ${{ env.after }}](https://github.com/NixOS/nixpkgs-check-by-name/releases/tag/${{ env.after }}).