summaryrefslogtreecommitdiff
path: root/module.nix
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-10-05 16:25:31 +0200
committerpennae <github@quasiparticle.net>2022-10-07 19:51:10 +0200
commit3de7d62a33d772cb5ae4fbc19fb91b632b2be667 (patch)
treead6cceab9af517c15cd5d0c75ad5e2f968a1432d /module.nix
parent50068653801991e67487f1b555b83f9232a3bd48 (diff)
downloadlabel-tracker-3de7d62a33d772cb5ae4fbc19fb91b632b2be667.tar.gz
label-tracker-3de7d62a33d772cb5ae4fbc19fb91b632b2be667.tar.xz
label-tracker-3de7d62a33d772cb5ae4fbc19fb91b632b2be667.zip
add tracking for PRs landing in channels
Diffstat (limited to 'module.nix')
-rw-r--r--module.nix23
1 files changed, 21 insertions, 2 deletions
diff --git a/module.nix b/module.nix
index e11048d..a418c29 100644
--- a/module.nix
+++ b/module.nix
@@ -51,6 +51,18 @@ in {
type = types.str;
description = "Name of the label.";
};
+
+ channels = mkOption {
+ type = types.attrsOf (types.listOf types.str);
+ description = ''
+ Branches to check for PR landing events (ie. changes of a
+ PR showing up in a given branch). Useful for channels.
+
+ Branch names my regular expressions. Targets can refer to
+ captures in the base ref regex with $1, $2 etc.
+ '';
+ default = {};
+ };
};
});
default = [];
@@ -78,7 +90,7 @@ in {
systemd.services.label-tracker = {
startAt = cfg.startAt;
- path = [ self.packages.${config.nixpkgs.system}.label-tracker ];
+ path = [ pkgs.git self.packages.${config.nixpkgs.system}.label-tracker ];
environment.RUST_LOG = "info";
script = ''
set -euo pipefail
@@ -92,6 +104,11 @@ in {
owner = escapeShellArg args.owner;
repo = escapeShellArg args.repo;
label = escapeShellArg args.label;
+ patterns = escapeShellArg
+ (concatStringsSep ","
+ (mapAttrsToList
+ (base: targets: "${base}:${concatStringsSep " " targets}")
+ args.channels));
in ''
(
umask 0077
@@ -100,7 +117,9 @@ in {
label-tracker init states/${name} ${owner} ${repo} ${label}
fi
label-tracker sync-issues states/${name}
- label-tracker sync-prs states/${name}
+ label-tracker sync-prs states/${name} \
+ -l states/${name}.git \
+ -p ${patterns}
)
(
umask 0027