From cf485ab991812bc4efd4bd4f2b4600d7833290b0 Mon Sep 17 00:00:00 2001 From: Jason Dent Date: Mon, 16 May 2022 16:13:28 +0200 Subject: [PATCH] ci: Improve dictionary update workflow (#2839) * ci: Improve dictionary update workflow * Update update-dictionaries.yml --- .github/workflows/update-dictionaries.yml | 32 +++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/update-dictionaries.yml b/.github/workflows/update-dictionaries.yml index 431752cd6b6..0398068d56e 100644 --- a/.github/workflows/update-dictionaries.yml +++ b/.github/workflows/update-dictionaries.yml @@ -4,19 +4,16 @@ on: push: branches: - main - paths: - - "**/package.json" - - "**/package-lock.json" workflow_dispatch: schedule: - - cron: "0 12 * * 0" + - cron: "0 7 * * *" permissions: contents: read jobs: - update-dependencies: + update-dictionaries: if: github.repository_owner == 'streetsidesoftware' runs-on: ubuntu-latest env: @@ -27,42 +24,55 @@ jobs: uses: actions/checkout@v3 with: ref: ${{ env.REF_BRANCH }} + - name: Use Node.js uses: actions/setup-node@v3.1.1 with: cache: npm + - name: Setup NPM run: npm i -g npm@8 + - name: Install run: npm install + - name: Update Dictionaries run: | npm run update-dictionary-packages + + - name: Has changes + run: | + git --no-pager diff --compact-summary --exit-code && echo "git_status=clean" >> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV + git --no-pager diff --compact-summary + + - name: Echo git_status + run: echo ${{ env.git_status }} + - name: Build + if: env.git_status == 'dirty' run: | npm run build + - name: Update Integration Test Snapshots + if: env.git_status == 'dirty' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | npm run update-snapshots - - name: Has changes - run: | - git --no-pager diff --compact-summary --exit-code && echo "git_status=clean" >> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV - git --no-pager diff --compact-summary + - name: Gen Body run: | echo 'git_body<> $GITHUB_ENV git --no-pager diff --compact-summary >> $GITHUB_ENV echo 'DIFF' >> $GITHUB_ENV - - name: Echo git_status - run: echo ${{ env.git_status }} + - uses: tibdex/github-app-token@7ce9ffdcdeb2ba82b01b51d6584a6a85872336d4 # v1.5 # cspell:ignore tibdex if: env.git_status == 'dirty' id: generate-token with: app_id: ${{ secrets.AUTOMATION_APP_ID }} private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} + - name: Create Pull Request if: env.git_status == 'dirty' uses: peter-evans/create-pull-request@f094b77505fb89581e68a1163fbd2fffece39da1 # v4