1+ name : Verify FFI Documentation
2+
3+ on :
4+ push :
5+ paths :
6+ - ' key-wallet-ffi/src/**/*.rs'
7+ - ' key-wallet-ffi/FFI_API.md'
8+ - ' key-wallet-ffi/scripts/generate_ffi_docs.py'
9+ - ' dash-spv-ffi/src/**/*.rs'
10+ - ' dash-spv-ffi/FFI_API.md'
11+ - ' dash-spv-ffi/scripts/generate_ffi_docs.py'
12+ - ' .github/workflows/verify-ffi-docs.yml'
13+ pull_request :
14+ paths :
15+ - ' key-wallet-ffi/src/**/*.rs'
16+ - ' key-wallet-ffi/FFI_API.md'
17+ - ' key-wallet-ffi/scripts/generate_ffi_docs.py'
18+ - ' dash-spv-ffi/src/**/*.rs'
19+ - ' dash-spv-ffi/FFI_API.md'
20+ - ' dash-spv-ffi/scripts/generate_ffi_docs.py'
21+ - ' .github/workflows/verify-ffi-docs.yml'
22+
23+ jobs :
24+ verify-key-wallet-docs :
25+ runs-on : ubuntu-latest
26+
27+ steps :
28+ - name : Checkout repository
29+ uses : actions/checkout@v4
30+
31+ - name : Set up Python
32+ uses : actions/setup-python@v5
33+ with :
34+ python-version : ' 3.10'
35+
36+ - name : Generate key-wallet-ffi documentation
37+ run : |
38+ cd key-wallet-ffi
39+ python3 scripts/generate_ffi_docs.py
40+
41+ - name : Check if key-wallet-ffi documentation is up to date
42+ run : |
43+ cd key-wallet-ffi
44+ if ! git diff --exit-code FFI_API.md; then
45+ echo "❌ key-wallet-ffi documentation is out of date!"
46+ echo ""
47+ echo "The FFI_API.md file needs to be regenerated."
48+ echo "Please run the following command and commit the changes:"
49+ echo ""
50+ echo " cd key-wallet-ffi && make update-docs"
51+ echo ""
52+ echo "Changes detected:"
53+ git diff FFI_API.md
54+ exit 1
55+ else
56+ echo "✅ key-wallet-ffi documentation is up to date"
57+ fi
58+
59+ verify-dash-spv-docs :
60+ runs-on : ubuntu-latest
61+
62+ steps :
63+ - name : Checkout repository
64+ uses : actions/checkout@v4
65+
66+ - name : Set up Python
67+ uses : actions/setup-python@v5
68+ with :
69+ python-version : ' 3.10'
70+
71+ - name : Generate dash-spv-ffi documentation
72+ run : |
73+ cd dash-spv-ffi
74+ python3 scripts/generate_ffi_docs.py
75+
76+ - name : Check if dash-spv-ffi documentation is up to date
77+ run : |
78+ cd dash-spv-ffi
79+ if ! git diff --exit-code FFI_API.md; then
80+ echo "❌ dash-spv-ffi documentation is out of date!"
81+ echo ""
82+ echo "The FFI_API.md file needs to be regenerated."
83+ echo "Please run the following command and commit the changes:"
84+ echo ""
85+ echo " cd dash-spv-ffi && make update-docs"
86+ echo ""
87+ echo "Changes detected:"
88+ git diff FFI_API.md
89+ exit 1
90+ else
91+ echo "✅ dash-spv-ffi documentation is up to date"
92+ fi
93+
94+ update-docs-comment :
95+ runs-on : ubuntu-latest
96+ if : failure() && github.event_name == 'pull_request'
97+ needs : [verify-key-wallet-docs, verify-dash-spv-docs]
98+
99+ permissions :
100+ pull-requests : write
101+
102+ steps :
103+ - name : Comment on PR
104+ uses : actions/github-script@v7
105+ with :
106+ script : |
107+ github.rest.issues.createComment({
108+ issue_number: context.issue.number,
109+ owner: context.repo.owner,
110+ repo: context.repo.repo,
111+ body: `## ⚠️ FFI Documentation Update Required
112+
113+ The FFI API documentation is out of date. Please regenerate it by running:
114+
115+ For key-wallet-ffi:
116+ \`\`\`bash
117+ cd key-wallet-ffi
118+ make update-docs
119+ \`\`\`
120+
121+ For dash-spv-ffi:
122+ \`\`\`bash
123+ cd dash-spv-ffi
124+ make update-docs
125+ \`\`\`
126+
127+ Then commit the changes:
128+ \`\`\`bash
129+ git add */FFI_API.md
130+ git commit -m "docs: update FFI API documentation"
131+ \`\`\`
132+
133+ This ensures the documentation stays in sync with the actual FFI functions.`
134+ })
0 commit comments