-
Notifications
You must be signed in to change notification settings - Fork 146
74 lines (61 loc) · 2.16 KB
/
copy-workflow.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Crowdin Copy and Create PR
on:
workflow_dispatch:
# push:
# paths: [ 'docs/**', 'platforms/**','i18n/en/**', 'src/pages/**', 'meeting-notes/**' ]
# branches: [ main ]
permissions:
contents: write
pull-requests: write
jobs:
crowdin_copy_and_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: Merge latest changes from origin/main
run: |
git fetch origin
git checkout main
git merge origin/main
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: yarn install
- name: Run crowdin:fix
run: yarn run crowdin:fix
- name: Configure Git
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Create and push changes to branch
if: steps.changes.outputs.changes == 'true'
run: |
BRANCH_NAME="crowdin-copy-changes"
git push origin --delete $BRANCH_NAME || true
git checkout -b $BRANCH_NAME
git add .
git commit -m "chore: Copy ignored files using crowdin:fix"
git push --force --set-upstream origin $BRANCH_NAME
echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV
- name: Install GitHub CLI
if: steps.changes.outputs.changes == 'true'
run: sudo apt-get install -y gh
- name: Create Pull Request
if: steps.changes.outputs.changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --repo ${{ github.repository }} --base main --head ${{ env.branch_name }} --title "Copy ignored files using crowdin:fix" --body "This PR was created by GitHub Actions to copy ignored files using the crowdin:fix command."