Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve auto updates #15

Merged
merged 5 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ jobs:

- name: update
run: |
nix-build -A pkgs.npins
result/bin/npins update nixpkgs
nix-build -A autoPrUpdate
result/bin/auto-pr-update > body

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "Automated Nixpkgs update"
branch: auto-nixpkgs-update
title: "Automated Nixpkgs update"
body: "Update the pinned Nixpkgs automatically"
# 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-check-by-name
committer: infinixbot <[email protected]>
author: infinixbot <[email protected]>
commit-message: "Automated update"
branch: auto-update
title: "Automated update"
body-path: body
24 changes: 24 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ build // {
];
};

# Run regularly by CI and turned into a PR
autoPrUpdate = pkgs.writeShellApplication {
name = "auto-pr-update";
runtimeInputs = with pkgs; [
npins
cargo
];
text =
let
commands = [
"npins update"
"cargo update"
];
in
''
echo "Run automated updates"
''
+ pkgs.lib.concatMapStrings (command: ''
echo -e '<details><summary>${command}</summary>\n\n```'
${command} 2>&1
echo -e '```\n</details>'
'') commands;
};

# Tests the tool on the pinned Nixpkgs tree, this is a good sanity check
checks.nixpkgs = pkgs.runCommand "test-nixpkgs-check-by-name" {
nativeBuildInputs = [
Expand Down