Skip to content

09.05.2024 merge upstream #11

09.05.2024 merge upstream

09.05.2024 merge upstream #11

name: Detect translation conflicts
on:
pull_request:
branches:
- master
jobs:
comment:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- id: create_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- run: echo "GH_TOKEN=${{ steps.create_token.outputs.token }}" >> "$GITHUB_ENV"
- name: Fetch repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup git
run: |
git config --local user.email "[email protected]"
git config --local user.name "SS220Manager"
- name: Try merging
continue-on-error: true
run: |
git merge origin/translate
- name: Save merge results
run: |
{
echo "MERGE_CONFLICTS<<EOF"
git diff --name-only --diff-filter=U | while read file; do
echo "- $file"
echo -e "\n\`\`\`"
git diff --diff-filter=U "$file" | sed -n '/<<<<<<</,/>>>>>>>/p'
echo -e "\n\`\`\`"
done
echo EOF
} >> $GITHUB_ENV
- name: Run script
uses: actions/github-script@v7
with:
script: |
const { MERGE_CONFLICTS } = process.env
if(!MERGE_CONFLICTS) {
return
}
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `This pr causes following conflicts on translate branch:\n ${MERGE_CONFLICTS} `
})