freeCodeCamp/.github/workflows/no-prs-to-translation.yml

34 lines
1.5 KiB
YAML
Raw Normal View History

name: No translate on GitHub
on:
pull_request_target:
branches:
- 'main'
paths:
- 'curriculum/challenges/**'
- '!curriculum/challenges/english/**'
jobs:
has-translation:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
if (context.payload.pull_request.head.repo.fork) {
await github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Thanks for your pull-request. We are no longer accepting curriculum-related changes to non-English files. Please visit [our contributing guidelines](https://contribute.freecodecamp.org) to learn more about translating freeCodeCamp's resources.'
})
throw new Error('This PR appears to touch translated curriculum files.')
} else {
await github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'WAIT! This message serves as a sanity check. Your PR appears to come from the base freeCodeCamp repository and modifies translated curriculum files. Before merging, please confirm that the commits on this PR originated from the Crowdin download action.'
})
}