From 950841c25ea005f30050cdac545f87933cea038a Mon Sep 17 00:00:00 2001 From: "Nicholas Carrigan (he/him)" Date: Thu, 18 Feb 2021 08:04:03 -0800 Subject: [PATCH] fix(tools): no i18n workflow (#41157) * fix(tools): adjust no-translate workflow Modifies the no-prs-to-translation workflow to target our new `main` branch, and verify that the PR comes from a forked repository. Co-authored-by: Oliver Eyton-Williams Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> --- .github/workflows/no-prs-to-translation.yml | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/no-prs-to-translation.yml b/.github/workflows/no-prs-to-translation.yml index 1588ed5bf5..a1a8c14309 100644 --- a/.github/workflows/no-prs-to-translation.yml +++ b/.github/workflows/no-prs-to-translation.yml @@ -2,7 +2,7 @@ name: No translate on GitHub on: pull_request_target: branches: - - 'master' + - 'main' paths: - 'curriculum/challenges/**' - '!curriculum/challenges/english/**' @@ -16,10 +16,19 @@ jobs: with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - await github.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'We have implemented a new policy of no longer accepting curriculum-related PRs with changes to non-English files. We plan to implement a better way to translate the English challenges in the near future. We will make an announcement when it is ready. For now, please revert your changes to the non-English challenge files. Thank you.' - }) - throw new Error('This PR appears to touch translated challenge files.') + if (context.payload.pull_request.head.repo.fork) { + 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.' + }) + core.setFailed('This PR appears to touch translated challenge files.') + } else { + 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.' + }) + }