From 3a705374d7a03e14ef37880510fff7757a9cd78f Mon Sep 17 00:00:00 2001 From: Jason Dent Date: Mon, 16 May 2022 10:08:17 +0200 Subject: [PATCH] ci: Create update-dictionaries.yml --- .github/workflows/update-dictionaries.yml | 76 +++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/update-dictionaries.yml diff --git a/.github/workflows/update-dictionaries.yml b/.github/workflows/update-dictionaries.yml new file mode 100644 index 00000000000..431752cd6b6 --- /dev/null +++ b/.github/workflows/update-dictionaries.yml @@ -0,0 +1,76 @@ +name: Update Dictionaries Main + +on: + push: + branches: + - main + paths: + - "**/package.json" + - "**/package-lock.json" + + workflow_dispatch: + schedule: + - cron: "0 12 * * 0" + +permissions: + contents: read + +jobs: + update-dependencies: + if: github.repository_owner == 'streetsidesoftware' + runs-on: ubuntu-latest + env: + NEW_BRANCH: "update-dictionaries-main" + REF_BRANCH: main + steps: + - name: Checkout code + 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: Build + run: | + npm run build + - name: Update Integration Test Snapshots + 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 + with: + commit-message: "ci: Workflow Bot -- Update Dictionaries" + branch: ${{ env.NEW_BRANCH }} + base: ${{ env.REF_BRANCH }} + title: "ci: Workflow Bot -- Update Dictionaries (${{ env.REF_BRANCH }})" + token: ${{ steps.generate-token.outputs.token }} + body: ${{ env.git_body }} + delete-branch: true