Merge pull request #597 from anxdpanic/pr_isengard
add workflow to comment on and close translation PRspull/605/head
commit
fa30d8e46d
1 changed files with 62 additions and 0 deletions
@ -0,0 +1,62 @@ |
||||
name: Close Translation Pull Requests |
||||
|
||||
on: |
||||
pull_request: |
||||
branches: [ master, main, dev ] |
||||
|
||||
jobs: |
||||
|
||||
close-translation-prs: |
||||
if: github.actor != 'weblate' && github.actor != 'anxdpanic' && github.repository == 'anxdpanic/plugin.video.twitch' |
||||
|
||||
name: Close Translation Pull Requests |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: Get changed files |
||||
id: modified_files |
||||
uses: trilom/file-changes-action@v1.2.4 |
||||
with: |
||||
output: "," |
||||
|
||||
- name: Check the PR for translations |
||||
id: check |
||||
run: | |
||||
shopt -s nocasematch |
||||
if [[ "${{ steps.modified_files.outputs.files_modified }}" == *"en_gb/strings.po"* ]]; then |
||||
echo "Found modified en_gb, likely a valid PR" |
||||
unset CLOSE |
||||
elif [[ "${{ steps.modified_files.outputs.files_modified }}" == *"strings.po"* ]]; then |
||||
echo "Found modified strings.po, unwanted." |
||||
CLOSE="true" |
||||
elif [[ "${{ steps.modified_files.outputs.files_added }}" == *"strings.po"* ]]; then |
||||
echo "Found added strings.po, unwanted." |
||||
CLOSE="true" |
||||
elif [[ "${{ steps.modified_files.outputs.files_removed }}" == *"strings.po"* ]]; then |
||||
echo "Found removed strings.po, unwanted." |
||||
CLOSE="true" |
||||
else |
||||
echo "No strings.po were modified or added, not a translation." |
||||
unset CLOSE |
||||
fi |
||||
echo ::set-output name=close::${CLOSE} |
||||
|
||||
- name: Comment on the PR |
||||
uses: mshick/add-pr-comment@v1 |
||||
if: ${{ steps.check.outputs.close }} |
||||
with: |
||||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
||||
repo-token-user-login: 'github-actions[bot]' |
||||
allow-repeats: true |
||||
message: | |
||||
A modified strings.po file was detected. |
||||
|
||||
Translations are not accepted through PRs, please use Weblate if you'd like to contribute to the translations. |
||||
For more information see Issue #596. |
||||
|
||||
If you feel this PR was closed in error, please reply below. |
||||
Thank you for your interest in improving this add-on. |
||||
|
||||
- name: Close the PR |
||||
uses: peter-evans/close-pull@v1 |
||||
if: ${{ steps.check.outputs.close }} |
Loading…
Reference in new issue