-
-
Notifications
You must be signed in to change notification settings - Fork 9
131 lines (109 loc) · 3.85 KB
/
update-cspell.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: " 📚 Update CSpell"
on:
workflow_dispatch:
inputs:
base:
description: The Base Ref to apply the diff
required: false
default: "main"
push:
branches:
- main
schedule:
- cron: "0 12 * * *"
permissions:
contents: read
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: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.REF_BRANCH }}
- uses: streetsidesoftware/actions/public/setup-node-pnpm@v1
- name: Install
run: pnpm i
- name: Update CSpell
run: |
cd action-src
echo CSPELL_VERSION_OLD=$(pnpm exec cspell -V) >> $GITHUB_ENV
pnpm add cspell@latest cspell-glob@latest @cspell/cspell-bundled-dicts@latest
pnpm i
pnpm exec cspell -V
echo "CSPELL_VERSION=$(pnpm exec 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 Updates
run: |
pnpm i
- name: Clean Build
run: |
pnpm clean
pnpm build
- 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 ${{ env.CSPELL_VERSION == env.CSPELL_VERSION_OLD && 'Dictionaries and Dependencies' || 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
action-src/package.json
action/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 }}