Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<<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 | ||
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 |