|
| 1 | +name: Update HED Docs |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 6 * * 1' # Weekly Monday at 6am UTC |
| 6 | + workflow_dispatch: # Manual trigger |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + update-docs: |
| 14 | + name: Fetch Latest HED Docs |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v6 |
| 18 | + with: |
| 19 | + ref: develop |
| 20 | + token: ${{ secrets.RELEASE_PAT }} |
| 21 | + |
| 22 | + - uses: actions/setup-python@v6 |
| 23 | + with: |
| 24 | + python-version: '3.12' |
| 25 | + |
| 26 | + - uses: astral-sh/setup-uv@v7 |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: uv pip install --system httpx |
| 30 | + |
| 31 | + - name: Fetch latest HED docs |
| 32 | + run: python scripts/fetch_hed_docs.py |
| 33 | + |
| 34 | + - name: Check for changes |
| 35 | + id: changes |
| 36 | + run: | |
| 37 | + if git diff --quiet src/data/hed-docs/; then |
| 38 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 39 | + else |
| 40 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 41 | + fi |
| 42 | +
|
| 43 | + - name: Create PR if docs changed |
| 44 | + if: steps.changes.outputs.changed == 'true' |
| 45 | + run: | |
| 46 | + git config user.name "github-actions[bot]" |
| 47 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 48 | + BRANCH="auto/update-hed-docs-$(date +%Y%m%d)" |
| 49 | + git checkout -b "$BRANCH" |
| 50 | + git add src/data/hed-docs/ |
| 51 | + git commit -m "Update bundled HED docs from upstream |
| 52 | +
|
| 53 | + Automated update from official HED documentation. |
| 54 | +
|
| 55 | + [skip-release]" |
| 56 | + git push origin "$BRANCH" |
| 57 | + gh pr create \ |
| 58 | + --base develop \ |
| 59 | + --title "Update bundled HED documentation" \ |
| 60 | + --body "$(cat <<'BODY' |
| 61 | + ## Summary |
| 62 | + Automated weekly update of bundled HED documentation from upstream sources. |
| 63 | +
|
| 64 | + Sources: |
| 65 | + - hed-standard/hed-resources (HedAnnotationSemantics.md) |
| 66 | + - hed-standard/hed-specification (02_Terminology.md) |
| 67 | +
|
| 68 | + This PR was created by the update-hed-docs workflow. |
| 69 | + BODY |
| 70 | + )" \ |
| 71 | + --label "documentation" |
| 72 | + env: |
| 73 | + GH_TOKEN: ${{ secrets.RELEASE_PAT }} |
0 commit comments