From 3e750062ea10351e9696f6fb99f12e3049413ca6 Mon Sep 17 00:00:00 2001 From: Maxim Schram Date: Fri, 20 Oct 2023 10:44:58 -0400 Subject: [PATCH] ci: split single workflow into scheduled and non-scheduled --- .github/workflows/ci-cd.yml | 63 ------------------------- .github/workflows/daily-help-update.yml | 41 ++++++++++++++++ .github/workflows/daily-tx-pull.yml | 53 +++++++++++++++++++++ 3 files changed, 94 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/daily-help-update.yml create mode 100644 .github/workflows/daily-tx-pull.yml diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 87fbca85..56c46758 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -5,11 +5,6 @@ on: pull_request: # Runs whenever a pull request is created or updated push: # Runs whenever a commit is pushed to the repository branches: [master, tx-pull-manual] - schedule: - # daily-tx-pull (e.g., daily at 3 AM UTC) - - cron: "0 3 * * *" - # daily-help-update (e.g., daily at 5 AM UTC) - - cron: "0 5 * * *" concurrency: group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" @@ -77,61 +72,3 @@ jobs: git tag $RELEASE_VERSION git push origin $RELEASE_VERSION fi - - daily-help-update: - runs-on: ubuntu-latest - - env: - # Organization-wide secrets - FRESHDESK_TOKEN: ${{ secrets.FRESHDESK_TOKEN }} - TX_TOKEN: ${{ secrets.TX_TOKEN }} - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - cache: "npm" - node-version-file: ".nvmrc" - - - name: Install dependencies - run: | - npm ci - npx browserslist@latest --update-db - - - name: Sync help - run: npm run sync:help - - daily-tx-pull: - runs-on: ubuntu-latest - - env: - # Organization-wide secrets - TX_TOKEN: ${{ secrets.TX_TOKEN }} - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - cache: "npm" - node-version-file: ".nvmrc" - - - name: Install dependencies - run: npm ci - - - name: Pull editor and www translations - run: | - npm run pull:editor - npm run pull:www - npm run test - - - name: Commit translation updates - run: | - git config --global user.email $(git log --pretty=format:"%ae" -n1) - git config --global user.name $(git log --pretty=format:"%an" -n1) - git add . - if git diff --cached --exit-code --quiet; then - echo "Nothing to commit." - else - git commit -m "pull new editor translations from Transifex" - git push origin HEAD:master - fi diff --git a/.github/workflows/daily-help-update.yml b/.github/workflows/daily-help-update.yml new file mode 100644 index 00000000..933bbe17 --- /dev/null +++ b/.github/workflows/daily-help-update.yml @@ -0,0 +1,41 @@ +name: Daily Help Update + +on: + workflow_dispatch: # Allows you to run this workflow manually from the Actions tab + schedule: + # daily-help-update (e.g., daily at 5 AM UTC) + - cron: "0 5 * * *" + +concurrency: + group: "${{ github.workflow }}" + cancel-in-progress: true + +permissions: + contents: write # publish a GitHub release + pages: write # deploy to GitHub Pages + issues: write # comment on released issues + pull-requests: write # comment on released pull requests + +jobs: + daily-help-update: + runs-on: ubuntu-latest + + env: + # Organization-wide secrets + FRESHDESK_TOKEN: ${{ secrets.FRESHDESK_TOKEN }} + TX_TOKEN: ${{ secrets.TX_TOKEN }} + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + cache: "npm" + node-version-file: ".nvmrc" + + - name: Install dependencies + run: | + npm ci + npx browserslist@latest --update-db + + - name: Sync help + run: npm run sync:help diff --git a/.github/workflows/daily-tx-pull.yml b/.github/workflows/daily-tx-pull.yml new file mode 100644 index 00000000..a07fef63 --- /dev/null +++ b/.github/workflows/daily-tx-pull.yml @@ -0,0 +1,53 @@ +name: Daily TX Pull + +on: + workflow_dispatch: # Allows you to run this workflow manually from the Actions tab + schedule: + # daily-tx-pull (e.g., daily at 3 AM UTC) + - cron: "0 3 * * *" + +concurrency: + group: "${{ github.workflow }}" + cancel-in-progress: true + +permissions: + contents: write # publish a GitHub release + pages: write # deploy to GitHub Pages + issues: write # comment on released issues + pull-requests: write # comment on released pull requests + +jobs: + daily-tx-pull: + runs-on: ubuntu-latest + + env: + # Organization-wide secrets + TX_TOKEN: ${{ secrets.TX_TOKEN }} + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + cache: "npm" + node-version-file: ".nvmrc" + + - name: Install dependencies + run: npm ci + + - name: Pull editor and www translations + run: | + npm run pull:editor + npm run pull:www + npm run test + + - name: Commit translation updates + run: | + git config --global user.email $(git log --pretty=format:"%ae" -n1) + git config --global user.name $(git log --pretty=format:"%an" -n1) + git add . + if git diff --cached --exit-code --quiet; then + echo "Nothing to commit." + else + git commit -m "pull new editor translations from Transifex" + git push origin HEAD:master + fi