Skip to content

Commit

Permalink
Add update-annotations workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vallode committed May 2, 2024
1 parent 805bc8f commit 5e5709a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ on:
push:
branches:
- main
workflow_call:
workflow_dispatch:

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -20,6 +19,7 @@ jobs:
with:
bundler-cache: true
- run: bundle exec rake
# TODO: Improve testing.
continue-on-error: true
- name: Build annotations
run: bundle exec rake build
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/update-annotations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Update annotations

on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:

jobs:
run:
name: Update annotations
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: ./.github/workflows/update-submodules.yml

- uses: ./.github/workflows/build.yml

- uses: actions/checkout@v4
with:
submodules: true

- name: Check if annotations changed
id: annotations_changed
run: echo "changed=$(git diff --quiet HEAD -- dist; echo $?)" >> $GITHUB_OUTPUT

- name: Setup git user
if: ${{ steps.annotations_changed.outputs.changed == true }}
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Commit changes
if: ${{ steps.annotations_changed.outputs.changed == true }}
run: |
git add dfhack df-structures
git commit -m "Auto-update annotations"
git push
7 changes: 2 additions & 5 deletions .github/workflows/update-submodules.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: Update submodules

on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
on: workflow_call

jobs:
run:
name: Update submodules
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
Expand Down

0 comments on commit 5e5709a

Please sign in to comment.