Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Théophane Hufschmitt committed Jun 5, 2024
1 parent 169390a commit cd03159
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ensure-up-to-date-schemas.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
jobs:
test:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -18,14 +20,17 @@ jobs:
run: |-
nix develop --command python3 ./extract-schemas.py
if ! git diff --exit-code; then
git checkout -b update-schemas-from-{{env.GITHUB_RUN_ID}}
BRANCH_NAME=update-schemas-from-${{env.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 "$BRANCH_NAME"
nix run --inputs-from . nixpkgs\#gh -- pr create \
--head "$BRANCH_NAME" \
--title "Re-generate the schema files" \
--body "Automated update from {{ env.GITHUB_RUN_ID }}"
--body "Automated update from ${{ env.GITHUB_RUN_ID }}"
fi
on:
push: {}
Expand Down
8 changes: 6 additions & 2 deletions gh-actions.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ in

ensure-up-to-date-schemas = {
jobs.test = {
permissions.pull-requests = "write",
runs-on = "ubuntu-latest",
steps =
setup
Expand All @@ -46,14 +47,17 @@ in
run = m%"
nix develop --command python3 ./extract-schemas.py
if ! git diff --exit-code; then
git checkout -b update-schemas-from-{{env.GITHUB_RUN_ID}}
BRANCH_NAME=update-schemas-from-${{env.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 "$BRANCH_NAME"
nix run --inputs-from . nixpkgs\#gh -- pr create \
--head "$BRANCH_NAME" \
--title "Re-generate the schema files" \
--body "Automated update from {{ env.GITHUB_RUN_ID }}"
--body "Automated update from ${{ env.GITHUB_RUN_ID }}"
fi
"%,
}
Expand Down

0 comments on commit cd03159

Please sign in to comment.