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

feat!: Update CSpell to v8 #402

Merged
merged 4 commits into from
Nov 7, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
matrix:
node-version:
# List of supported node versions (latest is tested in `test-os`)
- 16.x
- 18.x
- 20.x
- 21.x

os:
- ubuntu-latest
Expand All @@ -43,7 +43,7 @@ jobs:
matrix:
node-version:
# Test the latest node version here, move older versions to `test-old-node-versions`
- 16.x
- 18.x

os:
- windows-latest
Expand Down
116 changes: 77 additions & 39 deletions .github/workflows/update-cspell.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
name: " 📚 Update CSpell"

on:
workflow_dispatch:
inputs:
base:
description: The Base Ref to apply the diff
required: false
default: "main"

push:
branches:
- main
paths:
- "**/package.json"
- "**/package-lock.json"
workflow_dispatch:

schedule:
- cron: "0 7 * * *"

Expand All @@ -16,12 +23,15 @@ jobs:
if: github.repository_owner == 'streetsidesoftware'
runs-on: ubuntu-latest
env:
NEW_BRANCH: "update-cspell"
REF_BRANCH: main
NEW_BRANCH: update-cspell-${{ inputs.base || 'main' }}
REF_BRANCH: ${{ inputs.base || 'main' }}
steps:
- name: Start
env:
EVENT_INPUTS: ${{ toJson(github.event.inputs) }}
run: |
echo "${{ toJson(github.event.inputs) }}"
echo "$EVENT_INPUTS"

- name: Checkout code
uses: actions/checkout@v4
with:
Expand All @@ -30,27 +40,33 @@ jobs:
- name: Setup
uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node-version }}
node-version: 18.x

- name: Install
run: |
npm i

- name: CSpell Old Version
run: echo CSPELL_VERSION_OLD=$(npx cspell -V) >> $GITHUB_ENV

- name: Update CSpell to latest
run: |
npm i cspell@latest

- name: CSpell Version
run: echo CSPELL_VERSION=$(npx cspell -V) >> $GITHUB_ENV

- name: Minor Versions
run: |
echo CSPELL_MINOR_OLD=$(echo '"${{ env.CSPELL_VERSION_OLD }}"' | jq 'sub("\\.[0-9]+$";"")') >> $GITHUB_ENV
echo CSPELL_MINOR_NEW=$(echo '"${{ env.CSPELL_VERSION }}"' | jq 'sub("\\.[0-9]+$";"")') >> $GITHUB_ENV

- name: Determine Update type
env:
type: ${{ (env.CSPELL_MINOR_OLD == env.CSPELL_MINOR_NEW && 'fix') || 'feat' }}
run: |
echo PR_TYPE=$type >> $GITHUB_ENV

- name: Install
run: npm install

Expand All @@ -59,43 +75,65 @@ jobs:
npm run build:readme
npm run lint:fix

- 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
echo "### Workflow Bot -- Update CSpell to Latest" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "#### Package.json" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "\`\`\`\`\`\`diff" >> $GITHUB_ENV
git --no-pager diff package.json >> $GITHUB_ENV
echo "\`\`\`\`\`\`" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "#### Summary" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
git --no-pager diff --compact-summary >> $GITHUB_ENV
echo "DIFF" >> $GITHUB_ENV
- name: Git Status
id: git-status
uses: streetsidesoftware/actions/public/dirty@v1

- name: Echo git_status
env:
REPORT: |
Dirty: ${{ steps.git-status.outputs.isDirty && 'yes' || 'no' }}
CSpell Version: ${{ env.CSPELL_VERSION }}
Old Version: ${{ env.CSPELL_VERSION_OLD }}
run: |
echo "Status: ${{ env.git_status }}"
echo "CSpell Version: ${{ env.CSPELL_VERSION }}"
- uses: tibdex/[email protected] # cspell:ignore tibdex
if: env.git_status == 'dirty'
id: generate-token
echo "$REPORT"

- name: CSpell Version Msg
id: cspell_version_msg
uses: streetsidesoftware/actions/public/output@v1
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@v5
value: CSpell version (${{ env.CSPELL_VERSION }})

- name: Commit Message
id: commit_message
uses: streetsidesoftware/actions/public/output@v1
with:
value: >-
Update ${{ steps.cspell_version_msg.outputs.value }}

- name: Gen PR Body
id: body
uses: streetsidesoftware/actions/public/pr-body@v1
with:
title: ${{ steps.commit_message.outputs.value }}
message: |
**CSpell Version:** ${{ env.CSPELL_VERSION_OLD }} -> ${{ env.CSPELL_VERSION }}
**Type:** ${{ env.PR_TYPE }}
path: >-
package.json

- name: Show Summary
uses: streetsidesoftware/actions/public/summary@v1
with:
commit-message: "${{ env.PR_TYPE }}: Update CSpell to ${{ env.CSPELL_VERSION }}"
text: |
${{ steps.body.outputs.body }}

**Status:** ${{ steps.git-status.outputs.isDirty && 'dirty' || 'clean' }}

## Changes:

```
${{ steps.git-status.outputs.status }}
```

- name: PR
if: steps.git-status.outputs.isDirty
uses: streetsidesoftware/actions/.github/actions/pr@v1
with:
commit-message: "${{ env.PR_TYPE }}: ${{ steps.commit_message.outputs.value }}"
branch: ${{ env.NEW_BRANCH }}
base: ${{ env.REF_BRANCH }}
title: "${{ env.PR_TYPE }}: Workflow Bot -- Update CSpell to (${{ env.CSPELL_VERSION }}) (${{ env.REF_BRANCH }})"
token: ${{ steps.generate-token.outputs.token }}
body: ${{ env.git_body }}
delete-branch: true
title: "${{ env.PR_TYPE }}: ${{ steps.commit_message.outputs.value }}"
body: ${{ steps.body.outputs.body }}
app_id: ${{ secrets.AUTOMATION_APP_ID }}
app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
83 changes: 43 additions & 40 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
name: " 🔗 Update Dependencies Main"

on:
workflow_dispatch:
inputs:
base:
description: The Base Ref to apply the diff
required: false
default: "main"

push:
branches:
- main
paths:
- "**/package.json"
- "**/package-lock.json"
workflow_dispatch:

schedule:
- cron: "0 12 * * 0"

Expand All @@ -16,12 +23,15 @@ jobs:
if: github.repository_owner == 'streetsidesoftware'
runs-on: ubuntu-latest
env:
NEW_BRANCH: "update-dependencies-main"
REF_BRANCH: main
NEW_BRANCH: update-dependencies-${{ inputs.base || 'main' }}
REF_BRANCH: ${{ inputs.base || 'main' }}
steps:
- name: Start
env:
EVENT_INPUTS: ${{ toJson(github.event.inputs) }}
run: |
echo "${{ toJson(github.event.inputs) }}"
echo "$EVENT_INPUTS"

- name: Checkout code
uses: actions/checkout@v4
with:
Expand All @@ -30,55 +40,48 @@ jobs:
- name: Setup
uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node-version }}
node-version: 18.x

- name: Update Root
run: |
npm i
npx npm-check-updates -t minor -u
npx npm-check-updates -t semver -u
rm -rf node_modules package-lock.json

- name: Install
run: npm install

- name: Lint Fix
run: |
npm run lint:fix

- 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
echo "### Workflow Bot -- Update ALL Dependencies" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "#### Package.json" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "\`\`\`\`\`\`diff" >> $GITHUB_ENV
git --no-pager diff package.json >> $GITHUB_ENV
echo "\`\`\`\`\`\`" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "#### Summary" >> $GITHUB_ENV
echo "" >> $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/[email protected] # cspell:ignore tibdex
if: env.git_status == 'dirty'
id: generate-token
- name: Git Status
id: git-status
uses: streetsidesoftware/actions/public/dirty@v1

- name: Gen PR Body
id: body
uses: streetsidesoftware/actions/public/pr-body@v1
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@v5
title: Update Dependencies
path: >-
package.json

- name: Show Summary
uses: streetsidesoftware/actions/public/summary@v1
with:
commit-message: "ci: Workflow Bot -- Update ALL Dependencies"
text: |
${{ steps.body.outputs.body }}

**Status:** ${{ steps.git-status.outputs.isDirty && 'dirty' || 'clean' }}

- name: PR
uses: streetsidesoftware/actions/.github/actions/pr@v1
with:
commit-message: "chore: Workflow Bot -- Update ALL Dependencies"
branch: ${{ env.NEW_BRANCH }}
base: ${{ env.REF_BRANCH }}
title: "ci: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})"
token: ${{ steps.generate-token.outputs.token }}
body: ${{ env.git_body }}
delete-branch: true
title: "chore: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})"
body: ${{ steps.body.outputs.body }}
app_id: ${{ secrets.AUTOMATION_APP_ID }}
app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine
FROM node:18-alpine

WORKDIR /app
COPY package-lock.json package.json index.js ./
Expand Down
Loading