feat(tools): automatic crowdin prs (#41365)

* feat(tools): automatic crowdin prs

Enables automatic PR creation on all download scripts.

* feat: CRON everything

* fix(tools): stagger workflows
This commit is contained in:
Nicholas Carrigan (he/him)
2021-03-04 19:54:17 -08:00
committed by GitHub
parent d58e605825
commit 4fe3828537
6 changed files with 87 additions and 5 deletions

View File

@ -1,6 +1,9 @@
name: Crowdin Client UI Download
on:
workflow_dispatch:
schedule:
# runs every day at 12:15 PM UTC
- cron: "15 12 * * *"
jobs:
i18n-download-client-ui-translations:
@ -80,3 +83,38 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CLIENT }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
# Generate PR - all languages should go ABOVE this. #
- name: Create PR
uses: actions/github-script@v3
with:
github-token: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}
script: |
const PR = await github.pulls.create({
owner: 'freeCodeCamp',
repo: 'freeCodeCamp',
head: 'i18n-sync-learn',
base: 'main',
title: 'chore(i18n,client): processed translations',
body: 'This PR was opened auto-magically by Crowdin.'
});
const PRNumber = PR.data.number;
await github.issues.addLabels({
owner: 'freeCodeCamp',
repo: 'freeCodeCamp',
issue_number: PRNumber,
labels: [
"crowdin-sync",
"scope: i18n",
"scope: UI"
]
});
await github.pulls.requestReviewers({
owner: 'freeCodeCamp',
repo: 'freeCodeCamp',
pull_number: PRNumber,
reviewers: [
'RandellDawson',
'nhcarrigan'
]
});

View File

@ -1,6 +1,9 @@
name: Crowdin Client UI Upload
on:
workflow_dispatch:
schedule:
# runs everyday at 11:15 AM UTC
- cron: "15 11 * * *"
jobs:
i18n-upload-client-ui-files:

View File

@ -2,8 +2,8 @@ name: Crowdin Curriculum Download
on:
workflow_dispatch:
schedule:
# runs every day at 12:00 noon UTC
- cron: "0 12 * * *"
# runs every day at 12:30 PM UTC
- cron: "30 12 * * *"
jobs:
i18n-download-curriculum-translations:
@ -96,7 +96,7 @@ jobs:
repo: 'freeCodeCamp',
head: 'i18n-sync-learn',
base: 'main',
title: 'Crowdin Sync Learn',
title: 'chore(i18n,learn): processed translations',
body: 'This PR was opened auto-magically by Crowdin.'
});
const PRNumber = PR.data.number;

View File

@ -2,8 +2,8 @@ name: Crowdin Curriculum Upload
on:
workflow_dispatch:
schedule:
# runs everyday at 11:00 AM UTC
- cron: "0 11 * * *"
# runs everyday at 11:30 AM UTC
- cron: "30 11 * * *"
jobs:
i18n-upload-curriculum-files:

View File

@ -1,6 +1,9 @@
name: Crowdin Docs Download
on:
workflow_dispatch:
schedule:
# runs every day at 12:00 noon UTC
- cron: "0 12 * * *"
jobs:
i18n-download-docs-translations:
@ -114,3 +117,38 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_DOCS }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
# Generate PR - all languages should go ABOVE this. #
- name: Create PR
uses: actions/github-script@v3
with:
github-token: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}
script: |
const PR = await github.pulls.create({
owner: 'freeCodeCamp',
repo: 'freeCodeCamp',
head: 'i18n-sync-docs',
base: 'main',
title: 'chore(i18n,docs): processed translations',
body: 'This PR was opened auto-magically by Crowdin.'
});
const PRNumber = PR.data.number;
await github.issues.addLabels({
owner: 'freeCodeCamp',
repo: 'freeCodeCamp',
issue_number: PRNumber,
labels: [
"crowdin-sync",
"scope: i18n",
"scope: docs"
]
});
await github.pulls.requestReviewers({
owner: 'freeCodeCamp',
repo: 'freeCodeCamp',
pull_number: PRNumber,
reviewers: [
'RandellDawson',
'nhcarrigan'
]
});

View File

@ -1,6 +1,9 @@
name: Crowdin Docs Upload
on:
workflow_dispatch:
schedule:
# runs everyday at 11:00 AM UTC
- cron: "0 11 * * *"
jobs:
i18n-upload-docs-files: