-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (47 loc) · 1.5 KB
/
update_docs.yml
File metadata and controls
58 lines (47 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Update Documentation
on:
schedule:
# Run every Sunday at midnight
- cron: '0 0 * * 0'
workflow_dispatch:
permissions:
contents: write
jobs:
scrape-and-update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: scraper/go.sum
- name: Install dependencies and run scraper
run: |
cd scraper
go mod tidy
go run main.go
- name: Check for changes
id: git-check
run: |
# Force add docs folder to ensure we catch changes
git add -f docs/
git diff --staged --quiet || echo "changes=true" >> $GITHUB_OUTPUT
- name: Deploy to docs branch
if: steps.git-check.outputs.changes == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# Stash the docs changes
git stash push docs/
# Switch to or create orphan docs branch
git checkout --orphan docs
git rm -rf .
# Apply the docs changes
git stash pop
git add docs/
git commit -m "docs: update baritone documentation from $(date +'%Y-%m-%d') [skip ci]"
git push -f origin docs