Skip to content

Commit 540854e

Browse files
committed
Add update sources action
1 parent 743a7d9 commit 540854e

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"concurrency": {
3+
"cancel-in-progress": true,
4+
"group": "update"
5+
},
6+
"jobs": {
7+
"check": {
8+
"environment": {
9+
"name": "update-sources",
10+
"url": "${{steps.update.outputs.pull-request-url}}"
11+
},
12+
"runs-on": "ubuntu-latest",
13+
"steps": [
14+
{
15+
"uses": "actions/checkout@v4"
16+
},
17+
{
18+
"uses": "wimpysworld/nothing-but-nix@main",
19+
"with": {
20+
"hatchet-protocol": "holster"
21+
}
22+
},
23+
{
24+
"uses": "DeterminateSystems/nix-installer-action@main"
25+
},
26+
{
27+
"uses": "DeterminateSystems/magic-nix-cache-action@main"
28+
},
29+
{
30+
"run": "nix develop --accept-flake-config --override-input dendrix . --print-build-logs ./dev -c pins update"
31+
},
32+
{
33+
"run": "nix develop --accept-flake-config --override-input dendrix . --print-build-logs ./dev -c discover"
34+
},
35+
{
36+
"run": "nix flake --accept-flake-config check path:dev --override-input dendrix . --print-build-logs"
37+
},
38+
{
39+
"id": "update",
40+
"uses": "peter-evans/create-pull-request@v7",
41+
"with": {
42+
"assignees": "vic,copilot",
43+
"author": "Victor Borja <vborja@apache.org>",
44+
"body": "Please review.",
45+
"branch": "update-sources",
46+
"branch-suffix": "timestamp",
47+
"commit-message": "Update sources",
48+
"reviewers": "vic,copilot",
49+
"title": "Update community sources."
50+
}
51+
}
52+
]
53+
}
54+
},
55+
"name": "update sources",
56+
"on": {
57+
"repository_dispatch": {},
58+
"schedule": {
59+
"cron": "0 0 * * *"
60+
},
61+
"workflow_call": {},
62+
"workflow_dispatch": {}
63+
},
64+
"permissions": {
65+
"contents": "write",
66+
"id-token": "write",
67+
"pull-requests": "write"
68+
}
69+
}

dev/modules/gh-update-sources.nix

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
let
2+
name = "update-sources.yaml";
3+
path_ = ".github/workflows/${name}";
4+
in
5+
{
6+
perSystem =
7+
{ pkgs, ... }:
8+
{
9+
files.files = [
10+
{
11+
inherit path_;
12+
drv = pkgs.writers.writeJSON name {
13+
name = "update sources";
14+
on = {
15+
workflow_call = { };
16+
workflow_dispatch = { };
17+
repository_dispatch = { };
18+
schedule = {
19+
cron = "0 0 * * *";
20+
};
21+
};
22+
permissions = {
23+
contents = "write";
24+
pull-requests = "write";
25+
id-token = "write";
26+
};
27+
concurrency = {
28+
group = "update";
29+
cancel-in-progress = true;
30+
};
31+
jobs.check = {
32+
environment.name = "update-sources";
33+
environment.url = "\${{steps.update.outputs.pull-request-url}}";
34+
runs-on = "ubuntu-latest";
35+
steps = (import ./_gh-provision-nix.nix) ++ [
36+
{
37+
run = "nix develop --accept-flake-config --override-input dendrix . --print-build-logs ./dev -c pins update";
38+
}
39+
{
40+
run = "nix develop --accept-flake-config --override-input dendrix . --print-build-logs ./dev -c discover";
41+
}
42+
{
43+
run = "nix flake --accept-flake-config check path:dev --override-input dendrix . --print-build-logs";
44+
}
45+
{
46+
id = "update";
47+
uses = "peter-evans/create-pull-request@v7";
48+
"with" = {
49+
author = "Victor Borja <vborja@apache.org>";
50+
commit-message = "Update sources";
51+
branch = "update-sources";
52+
branch-suffix = "timestamp";
53+
title = "Update community sources.";
54+
body = "Please review.";
55+
assignees = "vic,copilot";
56+
reviewers = "vic,copilot";
57+
};
58+
}
59+
];
60+
};
61+
};
62+
}
63+
];
64+
treefmt.settings.global.excludes = [ path_ ];
65+
};
66+
}

0 commit comments

Comments
 (0)