Crowdin Copy and Create PR #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Crowdin Copy and Create PR | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
crowdin_copy_and_pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: yarn install | |
- name: Run crowdin:copy | |
run: yarn run crowdin:copy | |
- 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 new branch | |
if: steps.changes.outputs.changes == 'true' | |
run: | | |
git checkout -b crowdin-copy-changes || git checkout crowdin-copy-changes | |
git add . | |
git commit -m "chore: Copy ignored files using crowdin:copy" | |
git push --set-upstream origin crowdin-copy-changes | |
- name: Create Pull Request | |
if: steps.changes.outputs.changes == 'true' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: crowdin-copy-changes | |
title: "Copy ignored files using crowdin:copy" | |
body: "This PR was created by GitHub Actions to copy ignored files using the crowdin:copy command." | |
labels: "automation" |