Crowdin Download #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Crowdin Download | |
on: | |
# Allow manually triggering as well | |
workflow_dispatch: | |
# Run automatically in the middle of each month (we do it manually at the beginning) | |
schedule: | |
- cron: '0 0 15 * *' | |
env: | |
L10N_BRANCH_NAME: l10n_main | |
permissions: write-all | |
jobs: | |
crowdin-download: | |
name: Crowdin Download & Pull Request | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get current date | |
id: date | |
run: echo "current_date=$(date +'%-d %B %Y')" >> $GITHUB_OUTPUT | |
- name: Generate pull request title | |
id: pr-title | |
run: echo "pr_title=Crowdin translations for ${{ steps.date.outputs.current_date }}" >> $GITHUB_OUTPUT | |
- name: Generate PR branch name | |
id: branch-name | |
run: echo "branch_name=l10n-main-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Synchronize with Crowdin | |
uses: crowdin/github-action@v1 | |
with: | |
upload_sources: false | |
upload_translations: false | |
download_translations: true | |
skip_untranslated_strings: true | |
export_only_approved: true | |
create_pull_request: false | |
push_translations: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} | |
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
- name: Validate & post-process | |
run: python crowdin.py --delete-untranslated --crowdin-cli | |
continue-on-error: false | |
- name: Ensure user owns everything | |
run: sudo chown -R $USER:$USER . | |
- name: Add new files & create pull | |
id: new-files | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.REPO_GITHUB_TOKEN }} | |
commit-message: ${{ steps.pr-title.outputs.pr_title }} | |
base: main | |
branch: ${{ steps.branch-name.outputs.branch_name }} | |
delete-branch: true | |
title: ${{ steps.pr-title.outputs.pr_title }} | |
body: ${{ steps.pr-title.outputs.pr_title }} (automated) | |
add-paths: | | |
iNaturalist/src/main/res/values-**/strings.xml | |
- name: Print PR number & SHA | |
env: | |
number: ${{ steps.new-files.outputs.pull-request-number }} | |
sha: ${{ steps.new-files.outputs.pull-request-head-sha }} | |
run: echo "Pull Request ${number} (${sha})" | |
# Let's try it without this first to see how it goes. This will merge even if tests fail. | |
# - name: Merge Pull Request | |
# uses: juliangruber/merge-pull-request-action@v1 | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# number: ${{ steps.new-files.outputs.pull-request-number }} | |
# method: squash | |
notify: | |
name: Notify Slack | |
needs: crowdin-download | |
if: ${{ success() || failure() }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: iRoachie/[email protected] | |
if: env.SLACK_WEBHOOK_URL != null | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILDS_WEBHOOK_URL }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |