-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On a weekly basis: - Auto update the flake inputs - Auto update the schemas from schemastore.org
- Loading branch information
Théophane Hufschmitt
committed
Jun 5, 2024
1 parent
68b6f60
commit 663041d
Showing
5 changed files
with
143 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
jobs: | ||
update-flake-lock: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@v26 | ||
with: | ||
extra_nix_config: accept-flake-config = true | ||
- uses: cachix/cachix-action@v14 | ||
with: | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
name: nickel-schemastore | ||
- name: Update flake.lock | ||
uses: DeterminateSystems/update-flake-lock@v21 | ||
on: | ||
schedule: | ||
- cron: 0 0 * * 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
jobs: | ||
test: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@v26 | ||
with: | ||
extra_nix_config: accept-flake-config = true | ||
- uses: cachix/cachix-action@v14 | ||
with: | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
name: nickel-schemastore | ||
- env: | ||
GH_TOKEN: ${{ github.token }} | ||
name: Update the schemas from upstream | ||
run: |- | ||
nix develop --command python3 ./extract-schemas.py | ||
if ! git diff --exit-code; then | ||
BRANCH_NAME=update-schemas-from-$GITHUB_RUN_ID | ||
git checkout -b "$BRANCH_NAME" | ||
git add . | ||
git config user.name "Schemas update bot" | ||
git config user.email "noreply@schemaupdate.invalid" | ||
git commit --message="Re-generate the schema files" | ||
git push origin "$BRANCH_NAME" | ||
nix run --inputs-from . nixpkgs\#gh -- pr create \ | ||
--head "$BRANCH_NAME" \ | ||
--title "Re-generate the schema files" \ | ||
--body "Automated update from $GITHUB_RUN_ID" | ||
fi | ||
on: | ||
schedule: | ||
- cron: 0 0 * * 0 | ||
workflow_dispatch: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
let gha = import "./out/GitHub Workflow.ncl" in | ||
|
||
let setup = [ | ||
{ | ||
name = "Checkout", | ||
uses = "actions/checkout@v2", | ||
}, | ||
{ | ||
name = "Install Nix", | ||
uses = "cachix/install-nix-action@v26", | ||
with.extra_nix_config = "accept-flake-config = true", | ||
}, | ||
{ | ||
uses = "cachix/cachix-action@v14", | ||
with.name = "nickel-schemastore", | ||
with.authToken = "${{ secrets.CACHIX_AUTH_TOKEN }}", | ||
}, | ||
] | ||
in | ||
|
||
{ | ||
update-flake-lock = { | ||
jobs.update-flake-lock = { | ||
runs-on = "ubuntu-latest", | ||
steps = | ||
setup | ||
@ [ | ||
{ | ||
name = "Update flake.lock", | ||
uses = "DeterminateSystems/update-flake-lock@v21", | ||
} | ||
], | ||
}, | ||
on.schedule = [{ cron = "0 0 * * 0" }], | ||
}, | ||
|
||
update-schemas = { | ||
jobs.test = { | ||
permissions.pull-requests = "write", | ||
permissions.contents = "write", | ||
runs-on = "ubuntu-latest", | ||
steps = | ||
setup | ||
@ [ | ||
{ | ||
env.GH_TOKEN = "${{ github.token }}", | ||
name = "Update the schemas from upstream", | ||
run = m%" | ||
nix develop --command python3 ./extract-schemas.py | ||
if ! git diff --exit-code; then | ||
BRANCH_NAME=update-schemas-from-$GITHUB_RUN_ID | ||
git checkout -b "$BRANCH_NAME" | ||
git add . | ||
git config user.name "Schemas update bot" | ||
git config user.email "noreply@schemaupdate.invalid" | ||
git commit --message="Re-generate the schema files" | ||
git push origin "$BRANCH_NAME" | ||
nix run --inputs-from . nixpkgs\#gh -- pr create \ | ||
--head "$BRANCH_NAME" \ | ||
--title "Re-generate the schema files" \ | ||
--body "Automated update from $GITHUB_RUN_ID" | ||
fi | ||
"%, | ||
} | ||
], | ||
}, | ||
on.schedule = [{ cron = "0 0 * * 0" }], | ||
on.workflow_dispatch = {}, | ||
}, | ||
} | { _ | gha } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters