Skip to content

The open alternative to Salesforce, designed for AI.

Open i18n pull requests with the Twenty PR app (#29028)

Paul Rastoin0fd194049458
diff --git a/.github/workflows/docs-i18n-pull.yaml b/.github/workflows/docs-i18n-pull.yaml
index 2756d51b342..70cdd50be7c 100644
--- a/.github/workflows/docs-i18n-pull.yaml
+++ b/.github/workflows/docs-i18n-pull.yaml
@@ -2,7 +2,7 @@ name: 'Pull docs translations from Crowdin'
permissions:
contents: write
- pull-requests: write
+ pull-requests: read
on:
schedule:
@@ -35,6 +35,8 @@ jobs:
pull_docs_translations:
name: Pull docs translations
runs-on: ubuntu-latest
+ outputs:
+ pushed: ${{ steps.push_changes.outcome == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
@@ -42,21 +44,32 @@ jobs:
token: ${{ github.token }}
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
+ # Merging main into the i18n branch needs their shared history
+ fetch-depth: 0
+ filter: blob:none
- name: Install dependencies
uses: ./.github/actions/yarn-install
- - name: Setup i18n-docs branch
- if: github.event_name != 'pull_request'
- run: |
- git fetch origin i18n-docs || true
- git checkout -B i18n-docs origin/i18n-docs || git checkout -b i18n-docs
-
- name: Configure git
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
+ - name: Setup i18n-docs branch
+ if: github.event_name != 'pull_request'
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ # The branch only holds regenerable output, so restart it from main when
+ # there is no open PR to keep or when keeping it would conflict with main
+ if [ "$(gh pr list --head i18n-docs --base main --state open --json number --jq length)" = 0 ]; then
+ git checkout -B i18n-docs origin/main
+ else
+ git checkout -B i18n-docs origin/i18n-docs
+ git merge --no-edit origin/main || { git merge --abort && git checkout -B i18n-docs origin/main; }
+ fi
+
- name: Stash any changes before pulling translations
if: github.event_name != 'pull_request'
run: |
@@ -166,40 +179,26 @@ jobs:
fi
- name: Push changes
+ id: push_changes
if: github.event_name != 'pull_request' && steps.check_changes.outputs.changes_detected == 'true'
- run: git push origin HEAD:i18n-docs
-
- - name: Create pull request
- if: github.event_name != 'pull_request' && steps.check_changes.outputs.changes_detected == 'true'
- run: |
- if git diff --name-only origin/main..HEAD | grep -q .; then
- gh pr create -B main -H i18n-docs --title 'i18n - docs translations' --body 'Created by Github action' || true
- else
- echo "No file differences between branches, skipping PR creation"
- fi
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Mint twenty-infra dispatch token
- id: app-token
- if: github.event_name != 'pull_request' && steps.check_changes.outputs.changes_detected == 'true'
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
- with:
- client-id: ${{ vars.TWENTY_WORKFLOW_DISPATCHER_CLIENT_ID }}
- private-key: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
- owner: twentyhq
- repositories: twenty-infra
- permission-actions: write
-
- - name: Trigger i18n automerge
- if: github.event_name != 'pull_request' && steps.check_changes.outputs.changes_detected == 'true'
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
- gh workflow run automerge-i18n.yaml --repo twentyhq/twenty-infra --ref main
+ run: git push --force-with-lease origin HEAD:i18n-docs
- name: Fail run if any language failed to download
if: always() && steps.pull.outputs.failed_languages != ''
run: |
echo "::error::Crowdin download failed for:${{ steps.pull.outputs.failed_languages }}. These languages were skipped and are now stale — fix the source (e.g. build-breaking translations) and re-run."
exit 1
+
+ open_pull_request:
+ name: Open docs translations pull request
+ needs: pull_docs_translations
+ # Still runs when some languages failed to download, as the others were pushed
+ if: ${{ !cancelled() && needs.pull_docs_translations.outputs.pushed == 'true' }}
+ permissions: {}
+ uses: ./.github/workflows/i18n-open-pull-request.yaml
+ with:
+ branch: i18n-docs
+ title: 'i18n - docs translations'
+ secrets:
+ TWENTY_PR_PRIVATE_KEY: ${{ secrets.TWENTY_PR_PRIVATE_KEY }}
+ TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
diff --git a/.github/workflows/external-contributor-pr-auto-draft.yaml b/.github/workflows/external-contributor-pr-auto-draft.yaml
index cd6aedb4be5..708b746deda 100644
--- a/.github/workflows/external-contributor-pr-auto-draft.yaml
+++ b/.github/workflows/external-contributor-pr-auto-draft.yaml
@@ -10,6 +10,7 @@ jobs:
dispatch:
if: |
github.event.pull_request.draft == false &&
+ github.event.pull_request.user.type != 'Bot' &&
github.event.pull_request.author_association != 'MEMBER' &&
github.event.pull_request.author_association != 'OWNER' &&
github.event.pull_request.author_association != 'COLLABORATOR'
diff --git a/.github/workflows/i18n-open-pull-request.yaml b/.github/workflows/i18n-open-pull-request.yaml
new file mode 100644
index 00000000000..0e7488d4999
--- /dev/null
+++ b/.github/workflows/i18n-open-pull-request.yaml
@@ -0,0 +1,68 @@
+name: Open i18n pull request reusable workflow
+
+# Actions may not open PRs in this repo, so the Twenty PR app does. Its key stays
+# in the i18n environment, out of the callers' jobs that run yarn install.
+
+on:
+ workflow_call:
+ inputs:
+ branch:
+ required: true
+ type: string
+ title:
+ required: true
+ type: string
+ secrets:
+ # Only set on the i18n environment; callers still have to pass it by name
+ TWENTY_PR_PRIVATE_KEY:
+ required: true
+ TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY:
+ required: true
+
+permissions: {}
+
+jobs:
+ open-pull-request:
+ timeout-minutes: 5
+ runs-on: ubuntu-latest
+ environment:
+ name: i18n
+ deployment: false
+ steps:
+ - name: Mint Twenty PR token
+ id: twenty-pr-token
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
+ with:
+ client-id: ${{ vars.TWENTY_PR_CLIENT_ID }}
+ private-key: ${{ secrets.TWENTY_PR_PRIVATE_KEY }}
+ owner: twentyhq
+ repositories: twenty
+ permission-pull-requests: write
+
+ - name: Create a pull request
+ env:
+ GH_TOKEN: ${{ steps.twenty-pr-token.outputs.token }}
+ GH_REPO: ${{ github.repository }}
+ BRANCH: ${{ inputs.branch }}
+ TITLE: ${{ inputs.title }}
+ run: |
+ OPEN_PRS=$(gh pr list --head "$BRANCH" --base main --state open --json number --jq length)
+ if [ "$OPEN_PRS" = 0 ]; then
+ gh pr create -B main -H "$BRANCH" --title "$TITLE" --body 'Created by Github action'
+ fi
+
+ - name: Mint twenty-infra dispatch token
+ id: app-token
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
+ with:
+ client-id: ${{ vars.TWENTY_WORKFLOW_DISPATCHER_CLIENT_ID }}
+ private-key: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
+ owner: twentyhq
+ repositories: twenty-infra
+ permission-actions: write
+
+ - name: Trigger i18n automerge
+ env:
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
+ run: |
+ gh workflow run automerge-i18n.yaml --repo twentyhq/twenty-infra --ref main
diff --git a/.github/workflows/i18n-pull.yaml b/.github/workflows/i18n-pull.yaml
index 10ed88bc5be..eb282b76c0a 100644
--- a/.github/workflows/i18n-pull.yaml
+++ b/.github/workflows/i18n-pull.yaml
@@ -7,7 +7,7 @@ name: 'Pull translations from Crowdin'
permissions:
contents: write
- pull-requests: write
+ pull-requests: read
on:
schedule:
@@ -30,17 +30,32 @@ jobs:
name: Pull translations
runs-on: ubuntu-latest
timeout-minutes: 60
+ outputs:
+ pushed: ${{ steps.push_changes.outcome == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
token: ${{ github.token }}
ref: ${{ github.head_ref || github.ref_name }}
+ # Merging main into the i18n branch needs their shared history
+ fetch-depth: 0
+ filter: blob:none
- name: Setup i18n branch
+ env:
+ GH_TOKEN: ${{ github.token }}
run: |
- git fetch origin i18n || true
- git checkout -B i18n origin/i18n || git checkout -b i18n
+ git config --global user.name 'github-actions'
+ git config --global user.email '[email protected]'
+ # The branch only holds regenerable output, so restart it from main when
+ # there is no open PR to keep or when keeping it would conflict with main
+ if [ "$(gh pr list --head i18n --base main --state open --json number --jq length)" = 0 ]; then
+ git checkout -B i18n origin/main
+ else
+ git checkout -B i18n origin/i18n
+ git merge --no-edit origin/main || { git merge --abort && git checkout -B i18n origin/main; }
+ fi
- name: Install dependencies
uses: ./.github/actions/yarn-install
@@ -50,8 +65,6 @@ jobs:
- name: Stash any changes before pulling translations
run: |
- git config --global user.name 'github-actions'
- git config --global user.email '[email protected]'
git add .
git stash
@@ -117,37 +130,22 @@ jobs:
fi
- name: Push changes
+ id: push_changes
if: steps.compile_translations.outputs.changes_detected == 'true'
- run: git push origin HEAD:i18n
-
- - name: Create pull request
- if: steps.compile_translations.outputs.changes_detected == 'true'
- run: |
- if git diff --name-only origin/main..HEAD | grep -q .; then
- gh pr create -B main -H i18n --title 'i18n - translations' --body 'Created by Github action' || true
- else
- echo "No file differences between branches, skipping PR creation"
- fi
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: git push --force-with-lease origin HEAD:i18n
- name: Lint translations
run: npx nx run twenty-front:lint:i18n || echo "::warning::translation lint failed (non-blocking)"
- - name: Mint twenty-infra dispatch token
- id: app-token
- if: steps.compile_translations.outputs.changes_detected == 'true'
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
- with:
- client-id: ${{ vars.TWENTY_WORKFLOW_DISPATCHER_CLIENT_ID }}
- private-key: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
- owner: twentyhq
- repositories: twenty-infra
- permission-actions: write
-
- - name: Trigger i18n automerge
- if: steps.compile_translations.outputs.changes_detected == 'true'
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
- gh workflow run automerge-i18n.yaml --repo twentyhq/twenty-infra --ref main
+ open_pull_request:
+ name: Open translations pull request
+ needs: pull_translations
+ if: needs.pull_translations.outputs.pushed == 'true'
+ permissions: {}
+ uses: ./.github/workflows/i18n-open-pull-request.yaml
+ with:
+ branch: i18n
+ title: 'i18n - translations'
+ secrets:
+ TWENTY_PR_PRIVATE_KEY: ${{ secrets.TWENTY_PR_PRIVATE_KEY }}
+ TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
diff --git a/.github/workflows/i18n-push.yaml b/.github/workflows/i18n-push.yaml
index 5664ff08841..d4e87872ec0 100644
--- a/.github/workflows/i18n-push.yaml
+++ b/.github/workflows/i18n-push.yaml
@@ -2,7 +2,7 @@ name: 'Push translations to Crowdin'
permissions:
contents: write
- pull-requests: write
+ pull-requests: read
on:
workflow_dispatch:
@@ -22,17 +22,32 @@ jobs:
extract_translations:
name: Extract and upload translations
runs-on: ubuntu-latest
+ outputs:
+ pushed: ${{ steps.push_changes.outcome == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
token: ${{ github.token }}
ref: main
+ # Merging main into the i18n branch needs their shared history
+ fetch-depth: 0
+ filter: blob:none
- name: Setup i18n branch
+ env:
+ GH_TOKEN: ${{ github.token }}
run: |
- git fetch origin i18n || true
- git checkout -B i18n origin/i18n || git checkout -b i18n
+ git config --global user.name 'github-actions'
+ git config --global user.email '[email protected]'
+ # The branch only holds regenerable output, so restart it from main when
+ # there is no open PR to keep or when keeping it would conflict with main
+ if [ "$(gh pr list --head i18n --base main --state open --json number --jq length)" = 0 ]; then
+ git checkout -B i18n origin/main
+ else
+ git checkout -B i18n origin/i18n
+ git merge --no-edit origin/main || { git merge --abort && git checkout -B i18n origin/main; }
+ fi
- name: Install dependencies
uses: ./.github/actions/yarn-install
@@ -49,8 +64,6 @@ jobs:
- name: Check and commit extracted files
id: check_extract_changes
run: |
- git config --global user.name 'github-actions'
- git config --global user.email '[email protected]'
git add .
if ! git diff --staged --quiet --exit-code; then
git commit -m "chore: extract translations"
@@ -68,8 +81,6 @@ jobs:
- name: Check and commit compiled files
id: check_compile_changes
run: |
- git config --global user.name 'github-actions'
- git config --global user.email '[email protected]'
git add .
if ! git diff --staged --quiet --exit-code; then
git commit -m "chore: compile translations"
@@ -79,8 +90,9 @@ jobs:
fi
- name: Push changes and create remote branch if needed
+ id: push_changes
if: steps.check_extract_changes.outputs.changes_detected == 'true' || steps.check_compile_changes.outputs.changes_detected == 'true'
- run: git push origin HEAD:i18n
+ run: git push --force-with-lease origin HEAD:i18n
- name: Upload missing translations
if: steps.check_extract_changes.outputs.changes_detected == 'true'
@@ -97,31 +109,16 @@ jobs:
# App translations project
CROWDIN_PROJECT_ID: '1'
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- - name: Create a pull request
- if: steps.check_extract_changes.outputs.changes_detected == 'true' || steps.check_compile_changes.outputs.changes_detected == 'true'
- run: |
- if git diff --name-only origin/main..HEAD | grep -q .; then
- gh pr create -B main -H i18n --title 'i18n - translations' --body 'Created by Github action' || true
- else
- echo "No file differences between branches, skipping PR creation"
- fi
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Mint twenty-infra dispatch token
- id: app-token
- if: steps.check_extract_changes.outputs.changes_detected == 'true' || steps.check_compile_changes.outputs.changes_detected == 'true'
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
- with:
- client-id: ${{ vars.TWENTY_WORKFLOW_DISPATCHER_CLIENT_ID }}
- private-key: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
- owner: twentyhq
- repositories: twenty-infra
- permission-actions: write
- - name: Trigger i18n automerge
- if: steps.check_extract_changes.outputs.changes_detected == 'true' || steps.check_compile_changes.outputs.changes_detected == 'true'
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
- gh workflow run automerge-i18n.yaml --repo twentyhq/twenty-infra --ref main
+ open_pull_request:
+ name: Open translations pull request
+ needs: extract_translations
+ if: needs.extract_translations.outputs.pushed == 'true'
+ permissions: {}
+ uses: ./.github/workflows/i18n-open-pull-request.yaml
+ with:
+ branch: i18n
+ title: 'i18n - translations'
+ secrets:
+ TWENTY_PR_PRIVATE_KEY: ${{ secrets.TWENTY_PR_PRIVATE_KEY }}
+ TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
diff --git a/.github/workflows/website-i18n-pull.yaml b/.github/workflows/website-i18n-pull.yaml
index 3a0ee7ad073..a44c2dbdaf5 100644
--- a/.github/workflows/website-i18n-pull.yaml
+++ b/.github/workflows/website-i18n-pull.yaml
@@ -7,7 +7,7 @@ name: 'Pull website translations from Crowdin'
permissions:
contents: write
- pull-requests: write
+ pull-requests: read
on:
schedule:
@@ -30,17 +30,32 @@ jobs:
name: Pull website translations
runs-on: ubuntu-latest
timeout-minutes: 60
+ outputs:
+ pushed: ${{ steps.push_changes.outcome == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
token: ${{ github.token }}
ref: ${{ github.head_ref || github.ref_name }}
+ # Merging main into the i18n branch needs their shared history
+ fetch-depth: 0
+ filter: blob:none
- name: Setup website i18n branch
+ env:
+ GH_TOKEN: ${{ github.token }}
run: |
- git fetch origin i18n-website || true
- git checkout -B i18n-website origin/i18n-website || git checkout -b i18n-website
+ git config --global user.name 'github-actions'
+ git config --global user.email '[email protected]'
+ # The branch only holds regenerable output, so restart it from main when
+ # there is no open PR to keep or when keeping it would conflict with main
+ if [ "$(gh pr list --head i18n-website --base main --state open --json number --jq length)" = 0 ]; then
+ git checkout -B i18n-website origin/main
+ else
+ git checkout -B i18n-website origin/i18n-website
+ git merge --no-edit origin/main || { git merge --abort && git checkout -B i18n-website origin/main; }
+ fi
- name: Install dependencies
uses: ./.github/actions/yarn-install
@@ -50,8 +65,6 @@ jobs:
- name: Stash any changes before pulling translations
run: |
- git config --global user.name 'github-actions'
- git config --global user.email '[email protected]'
git add .
git stash
@@ -112,34 +125,19 @@ jobs:
fi
- name: Push changes
+ id: push_changes
if: steps.compile_translations.outputs.changes_detected == 'true'
- run: git push origin HEAD:i18n-website
-
- - name: Create pull request
- if: steps.compile_translations.outputs.changes_detected == 'true'
- run: |
- if git diff --name-only origin/main..HEAD | grep -q .; then
- gh pr create -B main -H i18n-website --title 'i18n - website translations' --body 'Created by Github action' || true
- else
- echo "No file differences between branches, skipping PR creation"
- fi
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Mint twenty-infra dispatch token
- id: app-token
- if: steps.compile_translations.outputs.changes_detected == 'true'
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
- with:
- client-id: ${{ vars.TWENTY_WORKFLOW_DISPATCHER_CLIENT_ID }}
- private-key: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
- owner: twentyhq
- repositories: twenty-infra
- permission-actions: write
-
- - name: Trigger i18n automerge
- if: steps.compile_translations.outputs.changes_detected == 'true'
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
- gh workflow run automerge-i18n.yaml --repo twentyhq/twenty-infra --ref main
+ run: git push --force-with-lease origin HEAD:i18n-website
+
+ open_pull_request:
+ name: Open website translations pull request
+ needs: pull_website_translations
+ if: needs.pull_website_translations.outputs.pushed == 'true'
+ permissions: {}
+ uses: ./.github/workflows/i18n-open-pull-request.yaml
+ with:
+ branch: i18n-website
+ title: 'i18n - website translations'
+ secrets:
+ TWENTY_PR_PRIVATE_KEY: ${{ secrets.TWENTY_PR_PRIVATE_KEY }}
+ TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
diff --git a/.github/workflows/website-i18n-push.yaml b/.github/workflows/website-i18n-push.yaml
index 053ae36e195..646738704ff 100644
--- a/.github/workflows/website-i18n-push.yaml
+++ b/.github/workflows/website-i18n-push.yaml
@@ -2,7 +2,7 @@ name: 'Push website translations to Crowdin'
permissions:
contents: write
- pull-requests: write
+ pull-requests: read
on:
workflow_dispatch:
@@ -23,17 +23,32 @@ jobs:
extract_website_translations:
name: Extract and upload website translations
runs-on: ubuntu-latest
+ outputs:
+ pushed: ${{ steps.push_changes.outcome == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
token: ${{ github.token }}
ref: main
+ # Merging main into the i18n branch needs their shared history
+ fetch-depth: 0
+ filter: blob:none
- name: Setup website i18n branch
+ env:
+ GH_TOKEN: ${{ github.token }}
run: |
- git fetch origin i18n-website || true
- git checkout -B i18n-website origin/i18n-website || git checkout -b i18n-website
+ git config --global user.name 'github-actions'
+ git config --global user.email '[email protected]'
+ # The branch only holds regenerable output, so restart it from main when
+ # there is no open PR to keep or when keeping it would conflict with main
+ if [ "$(gh pr list --head i18n-website --base main --state open --json number --jq length)" = 0 ]; then
+ git checkout -B i18n-website origin/main
+ else
+ git checkout -B i18n-website origin/i18n-website
+ git merge --no-edit origin/main || { git merge --abort && git checkout -B i18n-website origin/main; }
+ fi
- name: Install dependencies
uses: ./.github/actions/yarn-install
@@ -47,8 +62,6 @@ jobs:
- name: Check and commit extracted files
id: check_extract_changes
run: |
- git config --global user.name 'github-actions'
- git config --global user.email '[email protected]'
git add packages/twenty-website/src/locales
if ! git diff --staged --quiet --exit-code; then
git commit -m "chore: extract website translations"
@@ -63,8 +76,6 @@ jobs:
- name: Check and commit compiled files
id: check_compile_changes
run: |
- git config --global user.name 'github-actions'
- git config --global user.email '[email protected]'
git add packages/twenty-website/src/locales/generated
if ! git diff --staged --quiet --exit-code; then
git commit -m "chore: compile website translations"
@@ -74,8 +85,9 @@ jobs:
fi
- name: Push changes and create remote branch if needed
+ id: push_changes
if: steps.check_extract_changes.outputs.changes_detected == 'true' || steps.check_compile_changes.outputs.changes_detected == 'true'
- run: git push origin HEAD:i18n-website
+ run: git push --force-with-lease origin HEAD:i18n-website
- name: Upload missing website translations
if: steps.check_extract_changes.outputs.changes_detected == 'true'
@@ -93,31 +105,15 @@ jobs:
CROWDIN_PROJECT_ID: '4'
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- - name: Create a pull request
- if: steps.check_extract_changes.outputs.changes_detected == 'true' || steps.check_compile_changes.outputs.changes_detected == 'true'
- run: |
- if git diff --name-only origin/main..HEAD | grep -q .; then
- gh pr create -B main -H i18n-website --title 'i18n - website translations' --body 'Created by Github action' || true
- else
- echo "No file differences between branches, skipping PR creation"
- fi
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Mint twenty-infra dispatch token
- id: app-token
- if: steps.check_extract_changes.outputs.changes_detected == 'true' || steps.check_compile_changes.outputs.changes_detected == 'true'
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
- with:
- client-id: ${{ vars.TWENTY_WORKFLOW_DISPATCHER_CLIENT_ID }}
- private-key: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
- owner: twentyhq
- repositories: twenty-infra
- permission-actions: write
-
- - name: Trigger i18n automerge
- if: steps.check_extract_changes.outputs.changes_detected == 'true' || steps.check_compile_changes.outputs.changes_detected == 'true'
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
- gh workflow run automerge-i18n.yaml --repo twentyhq/twenty-infra --ref main
+ open_pull_request:
+ name: Open website translations pull request
+ needs: extract_website_translations
+ if: needs.extract_website_translations.outputs.pushed == 'true'
+ permissions: {}
+ uses: ./.github/workflows/i18n-open-pull-request.yaml
+ with:
+ branch: i18n-website
+ title: 'i18n - website translations'
+ secrets:
+ TWENTY_PR_PRIVATE_KEY: ${{ secrets.TWENTY_PR_PRIVATE_KEY }}
+ TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}