-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (65 loc) · 1.9 KB
/
ci.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
name: CI
on:
push:
branches:
- develop
- main
workflow_dispatch:
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
id: node
with:
node-version: 20.11.0
- name: Enable corepack
run: corepack enable
- name: Send Slack notification
uses: codedsolar/slack-action@v1
if: ${{ github.event_name != 'pull_request' }}
id: slack
with:
fields: |
{STATUS}
{REF}
Node.js: ${{ steps.node.outputs.node-version }}
Prettier issues: Checking...
status: in-progress
- name: Install Prettier
run: yarn global add prettier
- name: Lint
id: lint
run: |
export_output() {
env=${1^^}
env=${env//-/_}
export "$env=$2"
echo "export $env=$2"
echo "$1=$2" >> $GITHUB_OUTPUT
}
# output
export_output 'prettier-issues' "$(prettier --list-different . | wc -l)"
# lint
echo '---'
prettier --check . || true
# status
if [ "$PRETTIER_ISSUES" -eq 0 ]; then exit 0; else exit 1; fi
- name: Update Slack notification
uses: codedsolar/slack-action@v1
if: ${{ github.event_name != 'pull_request' && always() }}
with:
fields: |
{STATUS}
{REF}
Node.js: ${{ steps.node.outputs.node-version }}
Prettier issues: ${{ steps.lint.outputs.prettier-issues || 'Skipped' }}
status: ${{ job.status }}
timestamp: ${{ steps.slack.outputs.slack-timestamp }}