Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPDX-8446] Automate translation download and extraction #1209

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ jobs:
node-version-file: .tool-versions
- name: 📦 Install Dependencies
run: yarn install --immutable --immutable-cache
- name: 🌐 Extract Translations
run: yarn extract
- name: ⛅🔼 OneSky Upload
env:
ONESKY_API_KEY: ${{ secrets.ONESKY_API_KEY }}
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/onesky.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: OneSky Translation PR

on:
schedule:
# Run every day at 10:50am UTC (5:50am EST). To avoid delays and possibly dropped jobs GitHub
# recommends not scheduling jobs at the top of the hour.
- cron: '50 10 * * *'
workflow_dispatch:

permissions:
id-token: write
contents: write
pull-requests: write

jobs:
download:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .tool-versions
- name: 📦 Install Dependencies
run: yarn install --immutable --immutable-cache
- name: 🌐 Extract Translations
run: yarn extract
- name: ⛅🔽 OneSky Download
env:
ONESKY_API_KEY: ${{ secrets.ONESKY_API_KEY }}
ONESKY_API_SECRET: ${{ secrets.ONESKY_API_SECRET }}
ONESKY_PROJECT_ID: ${{ secrets.ONESKY_PROJECT_ID }}
run: yarn onesky:download
- name: 🔀 Create PR
uses: peter-evans/create-pull-request@v7
canac marked this conversation as resolved.
Show resolved Hide resolved
env:
# Disable git hooks because we are only modifying translation files
HUSKY: 0
with:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add reviewers to this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts about adding delete-branch: true to delete thre branch after each merge and so the branch is only around if changes are to be made.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts about adding delete-branch: true to delete thre branch after each merge and so the branch is only around if changes are to be made.

We have this repo configured to automatically delete branches from merged PRs, so that shouldn't be an issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add reviewers to this?

Adding team reviewers requires a Personal Access Token with repo scope or making a GitHub App with those permissions (https://github.com/peter-evans/create-pull-request/tree/v7/#action-inputs). If we use a PAT, we have to deal with rotating it when it expires and having to get someone else to create one if the person who created it leaves our GitHub org or the web-engineering-js team. It's also less secure to use a long-lived PAT instead of the short-lived automatic GITHUB_TOKEN. Making a GitHub App for this also doesn't feel worth it.

If the goal is to be alerted when this PR gets created, I think we can mention @CruGlobal/web-engineering-js in the PR body, and we'll all get a notification.

branch: bot-update-translations
add-paths: |
public/locales/
# Sign commits so that the author is a bot
sign-commits: true
commit-message: Run `yarn extract` and `yarn onesky:download`
title: '[no-Jira] Update translations'
body: Update translations with the latest labels extracted from the components and downloaded from OneSky.
1 change: 1 addition & 0 deletions amplify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ frontend:
- yarn
- yarn disable-telemetry
- yarn gql
- timeout 1m yarn onesky:download || echo "yarn onesky:download timed out after 1 minute or failed with an error"
build:
commands:
- yarn build:amplify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('AddAppealForm', () => {
expect(
await findByText(/must use a positive whole number for admin cost/i),
).toBeInTheDocument();
}, 6000);
}, 10000);

it('should calculate the Goal amount correctly', async () => {
const { getByRole } = render(<Components />);
Expand Down
Loading