action-flake-update-pr-individual: init
All checks were successful
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update-pr-clan-individual Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-ensure-tea-login Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-core-individual Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-create-pr Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update-pr-clan Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-core Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-homepage Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-infra Build done.
buildbot/nix-build .#checks.x86_64-linux.treefmt Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gitea Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-matrix-bot Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.package-matrix-bot Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-web01 Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-default Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-data-mesher Build done.
buildbot/nix-eval Build done.

Adds an action that allows updating flake inputs individually.
Sets up this action for the `clan-core` repo.
This commit is contained in:
a-kenji 2024-08-19 13:45:08 +02:00
parent 05cae050e5
commit 334a6b4644
5 changed files with 78 additions and 2 deletions

View File

@ -55,6 +55,7 @@ in
config = lib.mkMerge (
map configForJob [
"job-flake-update-clan-core"
"job-flake-update-clan-core-individual"
"job-flake-update-clan-homepage"
"job-flake-update-clan-infra"
"job-flake-update-data-mesher"

View File

@ -0,0 +1,23 @@
{
bash,
coreutils,
git,
openssh,
action-ensure-tea-login,
action-create-pr,
action-flake-update,
writePureShellScriptBin,
}:
writePureShellScriptBin "action-flake-update-pr-clan-individual"
[
bash
coreutils
git
openssh
action-ensure-tea-login
action-create-pr
action-flake-update
]
''
bash ${./script.sh}
''

View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
# prevent these variables from being unset by writePureShellScript
export KEEP_VARS="GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GITEA_URL GITEA_USER PR_TITLE REMOTE_BRANCH REPO_DIR${KEEP_VARS:+ $KEEP_VARS}"
# configure variables for actions
today=$(date --iso-8601)
today_minutes=$(date --iso-8601=minutes)
export REPO_DIR=$TMPDIR/repo
export GIT_AUTHOR_NAME="Clan Merge Bot"
export GIT_AUTHOR_EMAIL="clan-bot@git.clan.lol"
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_NAME"
export GITEA_USER="clan-bot"
export GITEA_URL="https://git.clan.lol"
inputs=$(nix flake info --json | jq '.locks.nodes | keys[]' | grep -v "root")
git clone --depth 1 --branch main "$REPO" "$REPO_DIR"
cd "$REPO_DIR"
for input in $inputs;
do
git checkout main
export PR_TITLE="Automatic flake update - ${input} - ${today_minutes}"
export REMOTE_BRANCH="flake-update-${input}-${today}"
action-ensure-tea-login
action-flake-update "$input"
action-create-pr --assignees clan-bot
done

View File

@ -26,12 +26,17 @@
inherit (writers) writePureShellScriptBin;
inherit (config.packages) action-ensure-tea-login action-create-pr action-flake-update;
};
action-flake-update-pr-clan-individual = pkgs.callPackage ./action-flake-update-pr-clan-individual {
inherit (writers) writePureShellScriptBin;
inherit (config.packages) action-ensure-tea-login action-create-pr action-flake-update;
};
inherit
(pkgs.callPackages ./job-flake-updates {
inherit (writers) writePureShellScriptBin;
inherit (config.packages) action-flake-update-pr-clan;
inherit (config.packages) action-flake-update-pr-clan action-flake-update-pr-clan-individual;
})
job-flake-update-clan-core
job-flake-update-clan-core-individual
job-flake-update-clan-homepage
job-flake-update-clan-infra
job-flake-update-data-mesher

View File

@ -1,4 +1,8 @@
{ action-flake-update-pr-clan, writePureShellScriptBin }:
{
action-flake-update-pr-clan,
action-flake-update-pr-clan-individual,
writePureShellScriptBin,
}:
let
job-flake-update =
repo:
@ -8,9 +12,20 @@ let
action-flake-update-pr-clan
'';
job-flake-update-individual =
repo:
writePureShellScriptBin "job-flake-update-individual-${repo}"
[ action-flake-update-pr-clan-individual ]
''
export REPO="gitea@git.clan.lol:clan/${repo}.git"
export KEEP_VARS="REPO''${KEEP_VARS:+ $KEEP_VARS}"
action-flake-update-pr-clan-individual
'';
in
{
job-flake-update-clan-core = job-flake-update "clan-core";
job-flake-update-clan-core-individual = job-flake-update-individual "clan-core";
job-flake-update-clan-homepage = job-flake-update "clan-homepage";
job-flake-update-clan-infra = job-flake-update "clan-infra";
job-flake-update-data-mesher = job-flake-update "data-mesher";