-
-
Notifications
You must be signed in to change notification settings - Fork 33
201 lines (176 loc) · 6.41 KB
/
scheduled-lint.yml
File metadata and controls
201 lines (176 loc) · 6.41 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: Scheduled Lint Check
on:
schedule:
# NOTE: Mondays @ 9 AM UTC
- cron: '0 9 * * 1'
workflow_dispatch:
jobs:
scheduled-pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Send Initial Slack Message
id: send_initial_slack_lint
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Started'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'FastAPI Guard - Scheduled Lint Check'
AUTHOR_LINK: 'https://github.com/rennf93/fastapi-guard'
AUTHOR_ICON: ':hammer_and_wrench:'
TITLE: 'MyPy and Ruff Checks Started'
TITLE_LINK: 'https://github.com/rennf93/fastapi-guard/actions'
MESSAGE: |
.
*VALIDATING MYPY AND RUFF...*
.
Running:
- Ruff formatting
- Ruff linting
- MyPy type checking
.
COLOR: warning
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install uv
run: pip install uv
- name: Install dependencies
run: uv sync --extra dev
- name: Run pre-commit checks
id: precommit
run: uv run pre-commit run --all-files
- name: Notify Success on Slack Channel
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Success'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'FastAPI Guard - Scheduled Lint Check'
AUTHOR_LINK: 'https://github.com/rennf93/fastapi-guard'
AUTHOR_ICON: ':gem:'
TITLE: 'Up-to-date MyPy and Ruff!'
TITLE_LINK: 'https://github.com/rennf93/fastapi-guard/actions'
MESSAGE: |
.
**All checks passed!**
.
COLOR: good
SLACK_THREAD_TS: ${{ steps.send_initial_slack_lint.outputs.SLACK_THREAD_TS }}
- name: Send Failure Notification to Slack
if: failure()
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Failed'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'FastAPI Guard - Scheduled Lint Check'
AUTHOR_LINK: 'https://github.com/rennf93/fastapi-guard'
AUTHOR_ICON: ':skull:'
TITLE: 'Outdated MyPy and/or Ruff!'
TITLE_LINK: 'https://github.com/rennf93/fastapi-guard/actions'
MESSAGE: |
.
**MYPY AND RUFF ARE OUTDATED!**
Run `make fix` | `make lint` to try, check and resolve.
.
COLOR: danger
SLACK_THREAD_TS: ${{ steps.send_initial_slack_lint.outputs.SLACK_THREAD_TS }}
scheduled-docs-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Send Initial Slack Message
id: send_initial_slack_docs_lint
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Started'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'FastAPI Guard - Scheduled Docs Lint Check'
AUTHOR_LINK: 'https://github.com/rennf93/fastapi-guard'
AUTHOR_ICON: ':memo:'
TITLE: 'Documentation Lint Check Started'
TITLE_LINK: 'https://github.com/rennf93/fastapi-guard/actions'
MESSAGE: |
.
*VALIDATING DOCUMENTATION...*
.
Running:
- Pymarkdownlnt formatting
- Pymarkdownlnt linting
.
COLOR: warning
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install pymarkdownlnt
run: pip install pymarkdownlnt
- name: Run markdown checks
id: markdown
run: |
pymarkdownlnt scan docs > markdown_output.txt 2>&1
EXIT_CODE=$?
OUTPUT=$(cat markdown_output.txt)
echo "output<<EOF" >> $GITHUB_OUTPUT
echo "$OUTPUT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
if [ $EXIT_CODE -eq 0 ]; then
echo "status=success" >> $GITHUB_OUTPUT
else
echo "status=failed" >> $GITHUB_OUTPUT
exit 1
fi
- name: Notify Markdown Success on Slack Channel
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Success'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'FastAPI Guard - Docs Lint Check'
AUTHOR_LINK: 'https://github.com/rennf93/fastapi-guard'
AUTHOR_ICON: ':gem:'
TITLE: 'Documentation is Up-to-date!'
TITLE_LINK: 'https://github.com/rennf93/fastapi-guard/actions'
MESSAGE: |
.
**All markdown checks passed!**
```
${{ steps.markdown.outputs.output }}
```
.
COLOR: good
SLACK_THREAD_TS: ${{ steps.send_initial_slack_docs_lint.outputs.SLACK_THREAD_TS }}
- name: Send Markdown Failure Notification to Slack
if: failure()
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Failed'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'FastAPI Guard - Docs Lint Check'
AUTHOR_LINK: 'https://github.com/rennf93/fastapi-guard'
AUTHOR_ICON: ':skull:'
TITLE: 'Documentation Issues Detected!'
TITLE_LINK: 'https://github.com/rennf93/fastapi-guard/actions'
MESSAGE: |
.
**DOCUMENTATION NEEDS FIXING!**
```
${{ steps.markdown.outputs.output }}
```
Run `make fix-docs` | `make lint-docs` to resolve.
.
COLOR: danger
SLACK_THREAD_TS: ${{ steps.send_initial_slack_docs_lint.outputs.SLACK_THREAD_TS }}