Skip to content

Commit

Permalink
fix(ci): .github/workflows/tx-pull.yml
Browse files Browse the repository at this point in the history
Turns out Github Action does not have bash profile so binary was not
correctly added to PATH.

Switched to a single branch while at it.
  • Loading branch information
lidel committed Jun 29, 2022
1 parent 0c47a69 commit 7ddf870
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
40 changes: 13 additions & 27 deletions .github/workflows/tx-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,17 @@ on:
- cron: '0 0 * * 0'

jobs:
install-tx-client-and-pull-translations:
tx-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache public folder
uses: actions/cache@v3
with:
path: public
key: ${{ github.sha }}
- name: Install Transifex client
run: |
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
chmod +x ./tx

This comment has been minimized.

Copy link
@lidel

lidel Jun 29, 2022

Author Member

install.sh does not add binary to PATH on CI because it can't find any profile, so I switched to executing it directly

- name: Pull translations from Transifex
run: |
tx -t ${{ secrets.TX_TOKEN }} pull -a
pull-request:
runs-on: ubuntu-latest
steps:
- name: Get cached public folder
uses: actions/cache@v3
with:
path: public
key: ${{ github.sha }}

# - name: Setup node
# uses: actions/setup-node@v2
# with:
# node-version: 16.14.x
./tx -t ${{ secrets.TX_TOKEN }} pull -a -f

This comment has been minimized.

Copy link
@lidel

lidel Jun 29, 2022

Author Member

Added -f because timestamp comparison logic does not work on CI and all file updates were skipped because transifex was older than copy on CI (maybe worker clock was off?)

This comment has been minimized.

Copy link
@SgtPooki

SgtPooki Jun 29, 2022

Member

that's interesting..

- uses: stefanzweifel/git-auto-commit-action@49620cd3ed21ee620a48530e81dba0d139c9cb80
with:
# Optional. Commit message for the created commit.
Expand All @@ -43,7 +25,7 @@ jobs:
# Optional. Local and remote branch name where commit is going to be pushed
# to. Defaults to the current branch.
# You might need to set `create_branch: true` if the branch does not exist.
branch: tx-pull-${{ github.sha }}
branch: i18n-sync

This comment has been minimized.

Copy link
@lidel

lidel Jun 29, 2022

Author Member

we can have a single branch (added push_options: --force below)


# Optional. Options used by `git-commit`.
# See https://git-scm.com/docs/git-commit#_options
Expand All @@ -54,15 +36,19 @@ jobs:
# See the `pathspec`-documentation for git
# - https://git-scm.com/docs/git-add#Documentation/git-add.txt-ltpathspecgt82308203
# - https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec
file_pattern: public/**/*.json
file_pattern: public/locales

# Optional. Local file path to the repository.
# Defaults to the root of the repository.
repository: .

# Optional. Options used by `git-add`.
# See https://git-scm.com/docs/git-add#_options
add_options: '-u'
add_options: '-A'

This comment has been minimized.

Copy link
@lidel

lidel Jun 29, 2022

Author Member

-u would ignore new files and only commit updates to preexisting ones, -A makes sure we add/remove/modify

This comment has been minimized.

Copy link
@SgtPooki

SgtPooki Jun 29, 2022

Member

I struggled with this because I really wanted it to not be a PR.. and -u would be best for automation (maybe I need more understanding of tx), but -A is absolutely best for PRs.

This comment has been minimized.

Copy link
@lidel

lidel Jun 30, 2022

Author Member

to be fair, I think in most cases -u is what you want (safe, won't add new stuff), but here we may have new files added by tx when a new language has enough strings translated :)


# Optional. Options used by `git-push`.
# See https://git-scm.com/docs/git-push#_options
push_options: '--force'

# Optional. Disable dirty check and always try to create a commit and push
skip_dirty_check: true
Expand All @@ -80,11 +66,11 @@ jobs:
# Optional. Create given branch name in local and remote repository.
create_branch: true
- name: pull-request
uses: repo-sync/pull-request@ff8726ae82c9970bde6527e419133aa167297c40
uses: repo-sync/pull-request@65785d95a5a466e46a9d0708933a3bd51bbf9dde
with:
source_branch: "tx-pull-${{ github.sha }}"
source_branch: "i18n-sync"
destination_branch: "main"
pr_title: "chore: Pull transifex translations"
pr_title: "chore: pull new translations"
pr_body: "Automated PR created by .github/workflows/tx-pull.yml"
pr_label: "area/i18n/translations"
pr_draft: false
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ yarn-error.log*
.eslintcache
tsconfig.tsbuildinfo
.connect-deps*

tx

0 comments on commit 7ddf870

Please sign in to comment.