-
-
Notifications
You must be signed in to change notification settings - Fork 21
72 lines (62 loc) · 2.24 KB
/
docs_sync.yml
File metadata and controls
72 lines (62 loc) · 2.24 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Documentation Sync
on:
pull_request:
branches: [ master ]
paths:
- 'src/**/*.rs'
- 'docs/**/*.md'
permissions:
contents: write
jobs:
sync-docs:
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
uses: actions/create-github-app-token@v2
id: generate-token
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: DecapodLabs
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
persist-credentials: false
- name: Configure Git for Private Dependencies
run: |
git config --global url."https://${{ secrets.PROPODUS_READONLY_PAT }}@github.com/DecapodLabs/propodus".insteadOf "https://github.com/DecapodLabs/propodus"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Decapod
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
GIT_TERMINAL_PROMPT: "0"
run: cargo build --all-features
- name: Get changed files
id: changed-files
run: |
git fetch origin master
FILES=$(git diff --name-only origin/master HEAD | xargs)
echo "files=$FILES" >> $GITHUB_OUTPUT
- name: Run Docs Build
run: |
FILES="${{ steps.changed-files.outputs.files }}"
if [ -n "$FILES" ]; then
./target/debug/decapod docs build --touched $FILES
else
./target/debug/decapod docs build
fi
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/${{ github.repository }}
git add docs/agent/command-contracts.md docs/agent/config-schema.md
if git diff --staged --quiet; then
echo "No doc changes detected."
else
git commit -m "docs: autogenerate/sync command contracts"
git push
fi