π Update CSpell #1179
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
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" | |
schedule: | |
- cron: "0 7 * * *" | |
jobs: | |
update-cspell: | |
if: github.repository_owner == 'streetsidesoftware' | |
runs-on: ubuntu-latest | |
env: | |
NEW_BRANCH: update-cspell-${{ inputs.base || 'main' }} | |
REF_BRANCH: ${{ inputs.base || 'main' }} | |
steps: | |
- name: Start | |
env: | |
EVENT_INPUTS: ${{ toJson(github.event.inputs) }} | |
run: | | |
echo "$EVENT_INPUTS" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.REF_BRANCH }} | |
- name: Setup | |
uses: ./.github/actions/setup | |
with: | |
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 | |
- name: Update Readme | |
run: | | |
npm run build:readme | |
npm run lint:fix | |
- 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 "$REPORT" | |
- name: CSpell Version Msg | |
id: cspell_version_msg | |
uses: streetsidesoftware/actions/public/output@v1 | |
with: | |
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: | |
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 }}: ${{ steps.commit_message.outputs.value }}" | |
body: ${{ steps.body.outputs.body }} | |
app_id: ${{ secrets.AUTOMATION_APP_ID }} | |
app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} |