From 499baa04225924b5919016d51cbafa470cb10e14 Mon Sep 17 00:00:00 2001 From: "Nicholas Carrigan (he/him)" Date: Mon, 25 Oct 2021 22:00:38 -0700 Subject: [PATCH] fix(tools): no comment for staff (#44004) fix(tools): no comment for staff --- .github/workflows/no-prs-to-translation.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/no-prs-to-translation.yml b/.github/workflows/no-prs-to-translation.yml index 4669cf08d4..ee34377864 100644 --- a/.github/workflows/no-prs-to-translation.yml +++ b/.github/workflows/no-prs-to-translation.yml @@ -17,9 +17,14 @@ jobs: steps: - uses: actions/github-script@v5 with: - github-token: ${{secrets.GITHUB_TOKEN}} + github-token: ${{secrets.CAMPERBOT_NO_TRANSLATE}} script: | - if (context.payload.pull_request.user.login !== "camperbot") { + 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) { core.setFailed('This PR appears to touch translated curriculum files.') github.rest.issues.createComment({ issue_number: context.issue.number, @@ -27,6 +32,8 @@ jobs: repo: context.repo.repo, 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)._" }) + } 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.'); } else { github.rest.issues.createComment({ issue_number: context.issue.number,