eo-ZZ: Apply #2868 #2869 #1031
Workflow file for this run
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: Translation Check | |
on: pull_request_target | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Pull Request | |
uses: actions/checkout@v2 | |
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@v2 | |
with: | |
repository: OpenRCT2/OpenRCT2 | |
ref: develop | |
path: OpenRCT2 | |
- name: Checkout translations before PR changes (for comparsion) | |
uses: actions/checkout@v2 | |
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@v2 | |
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@v2 | |
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 }} |