mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-24 18:25:41 +03:00
Split the workflows
Too many commands are hard to debug
This commit is contained in:
parent
f291d33ab0
commit
876480f87e
2 changed files with 36 additions and 24 deletions
28
.github/workflows/i18n-automerge.yml
vendored
28
.github/workflows/i18n-automerge.yml
vendored
|
@ -18,14 +18,7 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- run: npm ci
|
||||
|
||||
- name: Merge PR if there are significant changes
|
||||
run: |
|
||||
- run: |
|
||||
BASE_SHA="${{ github.event.pull_request.base.sha }}"
|
||||
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
|
||||
|
||||
|
@ -50,24 +43,11 @@ jobs:
|
|||
|
||||
# Check if the number of lines changed is more than 50
|
||||
if [ "$LINES_CHANGED" -le 50 ]; then
|
||||
echo "ERROR: 50 or fewer lines have been changed. Failing the check."
|
||||
exit 0
|
||||
else
|
||||
echo "Success: More than 50 lines have been changed."
|
||||
node scripts/catalogs.js
|
||||
if git diff --quiet src/data/catalogs.json; then
|
||||
echo "No changes to catalogs.json"
|
||||
else
|
||||
echo "Changes to catalogs.json"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git add src/data/catalogs.json
|
||||
git commit -m "Update catalogs.json"
|
||||
git push origin HEAD:l10n_main
|
||||
echo "Merging pull request"
|
||||
PR_NUMBER=$(echo ${{ github.event.pull_request.number }})
|
||||
gh pr merge $PR_NUMBER --auto --squash
|
||||
fi
|
||||
echo "More than 50 lines have been changed. Merging pull request."
|
||||
PR_NUMBER=$(echo ${{ github.event.pull_request.number }})
|
||||
gh pr merge $PR_NUMBER --auto --squash
|
||||
fi
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
32
.github/workflows/update-catalogs.yml
vendored
Normal file
32
.github/workflows/update-catalogs.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: Update catalogs
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'src/locales/**'
|
||||
|
||||
jobs:
|
||||
update-catalogs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- run: npm ci
|
||||
- name: Update catalogs.json
|
||||
run: |
|
||||
node scripts/catalogs.js
|
||||
if git diff --quiet src/data/catalogs.json; then
|
||||
echo "No changes to catalogs.json"
|
||||
else
|
||||
echo "Changes to catalogs.json"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git add src/data/catalogs.json
|
||||
git commit -m "Update catalogs.json"
|
||||
git push origin HEAD:main
|
||||
fi
|
Loading…
Reference in a new issue