Repository navigation
94 lines (80 loc) · 3.28 KB
/
Copy pathsync-clarity-reference.yml
File metadata and controls
94 lines (80 loc) · 3.28 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Sync Clarity reference from stacks-core
# Regenerates docs/reference/clarity/functions.md and keywords.md from the
# JSON emitted by `stacks-inspect docgen` in stacks-network/stacks-core, and
# opens a PR if there is drift.
#
# Runs weekly (Mondays 12:00 UTC) or on manual dispatch. The upstream
# `notices` field is populated in stacks-core, so drift-generation is safe.
on:
workflow_dispatch:
inputs:
stacks_core_ref:
description: "stacks-core branch/tag/sha to regenerate from"
required: false
default: "main"
schedule:
- cron: "0 12 * * 1" # Mondays 12:00 UTC
permissions:
contents: write
pull-requests: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout docs
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Checkout stacks-core
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: stacks-network/stacks-core
ref: ${{ inputs.stacks_core_ref || 'main' }}
path: stacks-core
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: stable
- name: Cache cargo registry & target
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry
~/.cargo/git
stacks-core/target
key: stacks-inspect-${{ runner.os }}-${{ hashFiles('stacks-core/Cargo.lock') }}
restore-keys: |
stacks-inspect-${{ runner.os }}-
- name: Build stacks-inspect
working-directory: stacks-core
run: cargo build --release -p stacks-inspect
- name: Dump Clarity API JSON
run: stacks-core/target/release/stacks-inspect docgen > clarity-api.json
- name: Set up Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "20"
- name: Regenerate reference markdown
run: node scripts/generate-clarity-reference.mjs clarity-api.json
- name: Detect drift
id: diff
run: |
if git diff --quiet -- docs/reference/clarity/functions.md docs/reference/clarity/keywords.md; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Open pull request
if: steps.diff.outputs.changed == 'true'
uses: peter-evans/create-pull-request@15733dbdfeedb4f7fdb73d13c6f5ac83b710fab8 # v8.1.2
with:
commit-message: "chore: sync Clarity reference from stacks-core"
title: "chore: sync Clarity reference from stacks-core"
body: |
Regenerated `docs/reference/clarity/functions.md` and `docs/reference/clarity/keywords.md`
from `stacks-inspect docgen` against stacks-network/stacks-core@${{ inputs.stacks_core_ref || 'main' }}.
Generated by `.github/workflows/sync-clarity-reference.yml`.
branch: chore/sync-clarity-reference
delete-branch: true
sign-commits: true
add-paths: |
docs/reference/clarity/functions.md
docs/reference/clarity/keywords.md