forked from bigtreetech/PandaTouch
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.57 KB
/
sync_translations.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
name: Sync New English With Translations
on:
pull_request_target:
types: [closed]
branches:
- master
jobs:
sync-trans:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
path: PR_REPO # Files will be checked out to the 'PR-REPO' directory
# Step to set up Python if necessary
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12' # Adjust based on your Python version
- name: Install dependencies
run: pip install ruamel.yaml
# Step to run the Python script and capture errors
- name: Run Sync
run: |
set -o pipefail
python PR_REPO/WorkflowScripts/sync_translations.py 2>&1 | tee python_output.log || (cat python_output.log && exit 1)
- name: Check for changes
id: check_diff
run: |
git diff --quiet --exit-code || echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
working-directory: PR_REPO
- name: Commit changes if detected
if: env.CHANGES_DETECTED == 'true'
run: |
git add .
git config --global user.name "BTTACTIONBOT"
git config --global user.email "[email protected]"
git commit -m "Apply automatic updates"
working-directory: PR_REPO
- name: Push changes
if: env.CHANGES_DETECTED == 'true'
run: |
git push
working-directory: PR_REPO