-
Notifications
You must be signed in to change notification settings - Fork 204
88 lines (74 loc) · 2.8 KB
/
translation_check.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Translation Check
on: pull_request_target
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get Pull Request
uses: actions/checkout@v4
with:
path: pr
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Get OpenRCT2 develop (for en-GB.txt)
uses: actions/checkout@v4
with:
repository: OpenRCT2/OpenRCT2
ref: develop
path: OpenRCT2
- name: Checkout translations before PR changes (for comparsion)
uses: actions/checkout@v4
with:
path: master
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
- name: Checkout commit before branch changes
id: merge-base-commit
run: |
echo "head sha: ${{github.event.pull_request.head.sha}}"
cd master
git remote add upstream https://github.com/${{github.repository}}
git fetch upstream
merge_base=$(git merge-base refs/remotes/upstream/master HEAD)
echo "merge base sha: ${merge_base}"
git checkout $merge_base
echo ::set-output name=merge_base::$merge_base
cd ..
- name: Print debug stuff
run: |
echo ${{steps.merge-base-commit.outputs.merge_base}}
echo ${{github.event.pull_request.head.sha}}
echo ${{steps.merge-base-commit.outputs.merge_base == github.event.pull_request.head.sha}}
- name: Remove master
if: ${{ steps.merge-base-commit.outputs.merge_base == github.event.pull_request.head.sha }}
run: rm -rf master
- name: Checkout upstream master as master
uses: actions/checkout@v4
if: ${{ steps.merge-base-commit.outputs.merge_base == github.event.pull_request.head.sha }}
with:
ref: master
path: master
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Checkout upstream master (in order to use the newest version of the script)
uses: actions/checkout@v4
with:
path: upstream_master
ref: master
- name: Run checks
run: python upstream_master/.github/workflows/translation_check.py
- id: get-comment-body
run: |
body=$(cat result.md)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Create PR comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{github.event.pull_request.number}}
body: ${{ steps.get-comment-body.outputs.body }}