Skip to content

Commit

Permalink
ci: try breaking up dictionary workflow into jobs (#2840)
Browse files Browse the repository at this point in the history
* ci: try breaking up dictionary workflow into jobs
* Update update-dictionaries.yml
* Limit update to dictionaries
  • Loading branch information
Jason3S committed May 16, 2022
1 parent c0b5f63 commit 95908a6
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 11 deletions.
59 changes: 49 additions & 10 deletions .github/workflows/update-dictionaries.yml
Expand Up @@ -12,18 +12,19 @@ on:
permissions:
contents: read

env:
NEW_BRANCH: "update-dictionaries-main"
REF_BRANCH: main

jobs:
update-dictionaries:
check-dictionaries:
if: github.repository_owner == 'streetsidesoftware'
runs-on: ubuntu-latest
env:
NEW_BRANCH: "update-dictionaries-main"
REF_BRANCH: main
outputs:
dirty: ${{ env.git_status == 'dirty' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ env.REF_BRANCH }}

- name: Use Node.js
uses: actions/setup-node@v3.1.1
Expand All @@ -48,13 +49,53 @@ jobs:
- name: Echo git_status
run: echo ${{ env.git_status }}

- name: Store Updated Package Info
# if: env.git_status == 'dirty'
uses: actions/upload-artifact@v3
with:
name: cspell-bundled-dicts
path: |
packages/cspell-bundled-dicts/package*.json
retention-days: 1

update-dictionaries:
needs: check-dictionaries
if: ${{ needs.check-dictionaries.outputs.dirty == 'true' }}
runs-on: ubuntu-latest
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: Restore Packages
uses: actions/download-artifact@v3
with:
name: cspell-bundled-dicts
path: |
packages/cspell-bundled-dicts
- name: Display structure of downloaded files
run: ls -alF
working-directory: packages/cspell-bundled-dicts

- name: Install
run: npm install

- 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: |
Expand All @@ -67,14 +108,12 @@ jobs:
echo 'DIFF' >> $GITHUB_ENV
- 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"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -54,7 +54,7 @@
"update-packages": "npm run update-packages-lerna && npm run update-packages-docs",
"update-packages-docs": "cd website && npm run update-packages",
"update-packages-lerna": "lerna exec \"npx npm-check-updates -t minor -u && rimraf node_modules package-lock.json && npm i\" && lerna bootstrap --no-ci",
"update-dictionary-packages": "lerna exec \"npx npm-check-updates -t minor -u && rimraf node_modules package-lock.json && npm i\" --scope \"@cspell/cspell-bundled-dicts\" && lerna bootstrap --no-ci",
"update-dictionary-packages": "lerna exec \"npx npm-check-updates -t minor -u \\\"/@cspell\\\\/dict/\\\" && npm i\" --scope \"@cspell/cspell-bundled-dicts\" && lerna bootstrap",
"update-integrations-and-snapshots": "lerna run update-repositories --scope cspell-integration-tests",
"update-snapshots": "lerna run update-snapshots-only --scope cspell-integration-tests"
},
Expand Down

0 comments on commit 95908a6

Please sign in to comment.