2021-01-15 13:28:01 +00:00
name : No translate on GitHub
2021-01-13 17:30:52 +00:00
on :
pull_request_target :
branches :
2021-02-18 16:04:03 +00:00
- 'main'
2021-01-13 17:30:52 +00:00
paths :
2021-03-30 17:11:14 +00:00
- 'curriculum/challenges/**/*.md'
2021-01-13 17:30:52 +00:00
- '!curriculum/challenges/english/**'
2021-02-24 19:28:16 +00:00
- 'client/i18n/locales/**/intro.json'
- 'client/i18n/locales/**/translations.json'
- '!client/i18n/locales/english/**'
2021-03-04 16:00:51 +00:00
- 'docs/i18n/**'
2021-01-13 17:30:52 +00:00
jobs :
has-translation :
2021-11-02 11:49:50 +00:00
runs-on : ubuntu-20.04
2021-01-13 17:30:52 +00:00
steps :
2021-10-01 07:02:40 +00:00
- uses : actions/github-script@v5
2021-01-13 17:30:52 +00:00
with :
2021-10-26 05:00:38 +00:00
github-token : ${{secrets.CAMPERBOT_NO_TRANSLATE}}
2021-01-13 17:30:52 +00:00
script : |
2021-10-26 05:00:38 +00:00
const isDev = await github.rest.teams.getMembershipForUserInOrg({
org : "freeCodeCamp" ,
team_slug : "dev-team" ,
username : context.payload.pull_request.user.login
}).catch(() => ({status: 404}));
if (context.payload.pull_request.user.login !== "camperbot" && isDev.status !== 200) {
2021-02-21 15:24:38 +00:00
core.setFailed('This PR appears to touch translated curriculum files.')
2021-10-01 17:32:20 +00:00
github.rest.issues.createComment({
2021-02-18 16:04:03 +00:00
issue_number : context.issue.number,
owner : context.repo.owner,
repo : context.repo.repo,
2021-03-10 21:14:19 +00:00
body : "Thanks for your pull-request.\n\nWe are no longer accepting changes to the non-English versions of files in parts of this codebase. This pull-request seems to change some of those. Please visit [our contributing guidelines](https://contribute.freecodecamp.org) to learn more about translating freeCodeCamp's resources.\n\nAs always, we value all of your contributions.\n\nHappy contributing!\n\n---\n_**Note:** This message was automatically generated by a bot. If you feel this message is in error or would like help resolving it, feel free to reach us [in our contributor chat](https://chat.freecodecamp.org/channel/contributors)._"
2021-02-18 16:04:03 +00:00
})
2021-10-26 05:00:38 +00:00
} else if (isDev.status === 200) {
core.setFailed('This PR appears to touch translated curriculum files, but since you are on the dev team there is no message.');
2021-02-18 16:04:03 +00:00
} else {
2021-10-01 17:32:20 +00:00
github.rest.issues.createComment({
2021-02-18 16:04:03 +00:00
issue_number : context.issue.number,
owner : context.repo.owner,
repo : context.repo.repo,
2021-03-05 03:56:42 +00:00
body : 'WAIT! This message serves as a sanity check. You should *only* see this message if the PR was created as part of a Crowdin download action.'
2021-02-18 16:04:03 +00:00
})
}