forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA
- Loading branch information
Showing
1,251 changed files
with
258,705 additions
and
275,233 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Detect translation file changes | ||
|
||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- lang/po/*.po | ||
- lang/po/*.pot | ||
|
||
|
||
jobs: | ||
detect-translation-file-changes: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Detect translation file changes" | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const skip_phrase = 'Translation file changes are intended'; | ||
if (context.payload.pull_request.body.includes(skip_phrase)) { | ||
console.log('PR body contains skip phrase. Exiting.'); | ||
return; | ||
} | ||
core.setFailed('Translation file changes detected, but a skip phrase is not found in the PR body.') | ||
console.log( | ||
'Fetching comments of pull request %d of repository %s/%s.', | ||
context.issue.number, context.repo.owner, context.repo.repo | ||
); | ||
const comments = await github.paginate( | ||
github.rest.issues.listComments, | ||
{ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number | ||
} | ||
); | ||
const body = 'It appears you modified a `.po` or `.pot` file. ' | ||
+ 'These translation files are automatically generated, ' | ||
+ 'pushed to, and pulled from Transifex, and should not be ' | ||
+ 'modified otherwise. If these changes are intended, please ' | ||
+ 'add `' + skip_phrase + '` to the ' | ||
+ 'PR body.'; | ||
const bot_comments = comments.filter( | ||
comment => comment.user.type === 'Bot' | ||
&& comment.user.login === 'github-actions[bot]' | ||
&& comment.body === body | ||
); | ||
if (bot_comments.length > 0) { | ||
console.log('Comment already exists. Exiting.'); | ||
return; | ||
} | ||
console.log('Posting comment.'); | ||
await github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: body | ||
}); |
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
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
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
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
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
Oops, something went wrong.