-
Notifications
You must be signed in to change notification settings - Fork 22
126 lines (105 loc) · 3.3 KB
/
pr-github-actions.yaml
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
name: Check github workflow
on:
push:
paths:
- ".github/**"
branches:
- main
pull_request:
branches:
- main
paths:
- ".github/**"
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
shell:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: get reporter name
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: "github-pr-review"
if_false: "github-check"
- name: shellcheck
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: ${{ steps.reporter.outputs.value }}
path: |
.github/
cloud/storage/core/tools/ci/
pattern: "*.sh"
- name: shfmt
uses: librarian/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: .github/
python:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: get reporter name
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: "github-pr-review"
if_false: "github-check"
- name: set up python environment
uses: actions/[email protected]
with:
python-version: "3.10"
- name: set up dependencies
run: pip install flake8 black[jupyter] flake8-docstrings flake8-simplify flake8-unused-arguments flake8-quotes
- name: flake8
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: .github/
reporter: ${{ steps.reporter.outputs.value }}
flake8_args: "--max-line-length 128 --ignore Q000,D100,D101,D102,D103,D104,D105,D106,D107"
- name: black
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: .github/
reporter: ${{ steps.reporter.outputs.value }}
workflows:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: install action-validator with asdf
uses: asdf-vm/actions/install@v3
with:
tool_versions: |
action-validator 0.5.4
- name: check workflows syntax
id: lint
run: |
set -x
export TMP_OUT=$(mktemp)
find .github/workflows -type f \( -iname \*.yaml -o -iname \*.yml \) \
| xargs -I {} action-validator --verbose {} > $TMP_OUT
echo "WORKFLOW_LINT=$(cat $TMP_OUT | awk -v ORS='\\n' 1)"
cat $TMP_OUT >> "$GITHUB_STEP_SUMMARY"
echo "WORKFLOW_LINT=$(cat $TMP_OUT | awk -v ORS='\\n' 1)" >> "$GITHUB_OUTPUT"
- name: comment on issue
uses: actions/[email protected]
if: ${{ github.event_name == 'pull_request' }}
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ steps.lint.outputs.WORKFLOW_LINT }}'
})