Skip to content

New Crowdin updates #10

New Crowdin updates

New Crowdin updates #10

Workflow file for this run

name: Auto Merge Crowdin Pull Requests
on:
pull_request:
types:
- opened
jobs:
merge:
runs-on: ubuntu-latest
steps:
- name: Check if PR is from Crowdin
id: check-crowdin-pr
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
PR_BODY="${{ github.event.pull_request.body }}"
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
REPO_OWNER="${{ github.repository_owner }}"
# Check if the title contains "New Crowdin updates"
if [[ "$PR_TITLE" != *"New Crowdin updates"* ]]; then
echo "PR title does not contain 'New Crowdin updates'. Exiting..."
exit 0
fi
# Check if the PR author is the repository owner
if [[ "$PR_AUTHOR" != "$REPO_OWNER" ]]; then
echo "PR author is not the repository owner. Exiting..."
exit 0
fi
# Add more checks as needed
# Example: Check for specific files, changes, or other criteria
# The above checks have passed so this is a Crowdin PR
# otherwise the job would have exited
# Set an environment variable to indicate this
echo "IS_CROWDIN_PR=true" >> $GITHUB_ENV
- name: Merge Crowdin PR
if: env.IS_CROWDIN_PR == 'true'
run: |
# Replace with your GitHub token and repository information
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
# Merge the pull request
curl -X PUT -H "Authorization: token $GITHUB_TOKEN" \
-d '{
"merge_method": "merge"
}' "$GITHUB_API_URL/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge"