Skip to content

Commit a3ad873

Browse files
committed
Add new CI to fetch new code samples
1 parent 5a664a1 commit a3ad873

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Actions done after Mintlify deployment following a push done on `main`.
2+
# This will trigger new commits on `main`, so a new deployment of Mintlify.
3+
name: Post Deployment
4+
5+
on:
6+
workflow_dispatch:
7+
# schedule:
8+
# - cron: '0 23 * * *' # Every day at 11:00 PM UTC
9+
# push:
10+
# branches:
11+
# - 'main'
12+
13+
jobs:
14+
update-samples:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v6
20+
with:
21+
token: ${{ secrets.GH_TOKEN }}
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v6
25+
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Run pull-code-samples script to fetch new code samples
30+
run: node scripts/pull-code-samples.mjs
31+
32+
- name: Check for changes
33+
id: changes
34+
run: |
35+
echo "has_changes=$(git diff --quiet snippets/ && echo "false" || echo "true")" >> "$GITHUB_ENV"
36+
37+
- name: Commit changes
38+
run: |
39+
if [[ $has_changes == "true" ]]; then
40+
echo "There are changes in the Git working directory."
41+
git config user.name "meili-bot"
42+
git config user.email "meili-bot@users.noreply.github.com"
43+
git add snippets/
44+
git commit -m "Update code samples"
45+
git push origin main
46+
else
47+
echo "No changes in the Git working directory."
48+
fi

0 commit comments

Comments
 (0)