Skip to content

Commit

Permalink
ci: Improve dictionary update workflow (#2839)
Browse files Browse the repository at this point in the history
* ci: Improve dictionary update workflow
* Update update-dictionaries.yml
  • Loading branch information
Jason3S committed May 16, 2022
1 parent 033c8b6 commit cf485ab
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/update-dictionaries.yml
Expand Up @@ -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:
Expand All @@ -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<<DIFF' >> $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
Expand Down

0 comments on commit cf485ab

Please sign in to comment.