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: try breaking up dictionary workflow into jobs #2840

Merged
merged 9 commits into from May 16, 2022
Merged
Show file tree
Hide file tree
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
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