Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Improve dictionary update workflow #2839

Merged
merged 2 commits into from May 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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