mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-17 13:01:46 -04:00
feat(.github): comment on i18n failure (#49746)
Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
26
.github/workflows/node.js-tests.yml
vendored
26
.github/workflows/node.js-tests.yml
vendored
@@ -218,3 +218,29 @@ jobs:
|
||||
CURRICULUM_LOCALE: ${{ matrix.locale }}
|
||||
CLIENT_LOCALE: ${{ matrix.locale }}
|
||||
run: pnpm test
|
||||
|
||||
failure-comment:
|
||||
name: Comment on i18n Failure
|
||||
needs: ['test', 'test-localization']
|
||||
runs-on: ubuntu-20.04
|
||||
if: ${{ always() && needs.test.result == 'success' && needs.test-localization.result == 'failure' }}
|
||||
steps:
|
||||
- uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6
|
||||
with:
|
||||
github-token: ${{ secrets.CAMPERBOT_NO_TRANSLATE }}
|
||||
script: |
|
||||
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) {
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: "Hi,\n\nIt looks like the localization tests have failed. This is expected when there are significant curriculum changes in the English version.\n\nThis could mean a Crowdin sync is required to address the scenario. Please check with our staff developer team, either on [Discord](https://discord.gg/KVUmVXA) or our [forums](https://forum.freecodecamp.org). They will confirm and take over helping you through the PR.\n\nThanks for your understanding and contribution."
|
||||
})
|
||||
} 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.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user