forked from ss220club/Bandastation
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (49 loc) · 1.45 KB
/
detect_translate_conflicts.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
name: Detect translation conflicts
on:
pull_request:
branches:
- master
jobs:
comment:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- 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\`\`\`diff"
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} `
})