-
Notifications
You must be signed in to change notification settings - Fork 37
60 lines (52 loc) · 1.69 KB
/
transform-and-sync.yml
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
name: Transform and sync
on:
schedule:
- cron: '0 0 * * SUN'
push:
branches:
- published
jobs:
nilakkhana-transform-and-sync-files:
runs-on: ubuntu-latest
steps:
- name: Checkout published branch
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11.3
- name: Execute python script to transform
run: |
python .nilakkhana/process_all_supported_files.py
- name: Check for changes
id: check-changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "There are changes to commit."
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "No changes to commit."
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: steps.check-changes.outputs.changes == 'true'
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "[GHA] Nilakkhana transform"
git push origin published:published
- name: Sync changed files to sc-data repo
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
src_branch: published
src_path: /.
dst_owner: suttacentral
dst_repo_name: sc-data
dst_path: /sc_bilara_data/
dst_branch: main
clean: true
commit_message: '[GHA] Nilakkhana transform and sync files from bilara-data repo.'