Github Action workflow that copies string translations from one repo into another and creates a PR.
name: Translation Export to Android Repo | |
on: | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
push_strings_to_over: | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, 'Automated checkin')" | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
path: 'android-i18n' | |
- name: Check out my other private repo | |
uses: actions/checkout@v2 | |
with: | |
path: 'android-app' | |
repository: repo-owner/android-app | |
token: ${{ secrets.I18N_TO_OVER_PAT }} | |
- name: Run rename script (renameall.sh) and commit to Android repo | |
run: | | |
cd android-app/ | |
git fetch | |
releaseBranchToCheckout=$(git branch -a | grep release | head -n 1 | xargs | cut -c 16-) | |
git checkout $releaseBranchToCheckout | |
echo "BASE_RELEASE_BRANCH=$releaseBranchToCheckout" >> $GITHUB_ENV | |
cd .. | |
cd android-i18n/ | |
./renameall.sh | |
cd .. | |
cp -R android-i18n/values-* android-app/resources/src/main/res/ | |
cd android-app/ | |
git config user.name "GitHub Actions" | |
git config user.email noreply@github.com | |
date=$(date '+%Y-%m-%d%H%M%S') | |
newBranchName=feature/new-translations-$date | |
echo "NEW_BRANCH_NAME=$newBranchName" >> $GITHUB_ENV | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.I18N_TO_OVER_PAT }} | |
path: android-app | |
base: ${{ env.BASE_RELEASE_BRANCH }} | |
commit-message: Update translations | |
committer: GitHub <noreply@github.com> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
branch: ${{ env.NEW_BRANCH_NAME }} | |
title: '🤖 Automation - New translations received for ${{ env.BASE_RELEASE_BRANCH }}' | |
body: | | |
New translations received from GoLF. | |
draft: false | |
- name: Slack notify | |
uses: rtCamp/action-slack-notify@master | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_CHANNEL: #android-bots | |
SLACK_TITLE: New translations have been received! 🌎 | |
SLACK_MESSAGE: Translation system has submitted new translations. Check them out here - ${{ steps.cpr.outputs.pull-request-url }} | |
MSG_MINIMAL: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment