-
Notifications
You must be signed in to change notification settings - Fork 21
115 lines (115 loc) · 4.14 KB
/
tek-repo-lint.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
---
name: tek-repo-lint
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
# IMPORTANT: Any new jobs need to be added to the check-repo-lint-passed job to ensure they correctly gate code changes
jobs:
check-for-codeowners-file:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Check for CODEOWNERS
id: codeowners_file
uses: initialstate/file-check-action@v1
with:
file: .github/CODEOWNERS
- name: CODEOWNERS file Output Test
run: echo ${{ steps.codeowners_file.outputs.file_exists }}
- name: CODEOWNERS file exists with content
if: steps.codeowners_file.outputs.file_exists == 'true'
run: echo CODEOWNERS file exists!
- name: CODEOWNERS file does not exist
if: steps.codeowners_file.outputs.file_exists == 'false'
run: echo CODEOWNERS file does not exist!
check-for-readme-file:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Check for README
id: readme_file
uses: initialstate/file-check-action@v1
with:
file: README
- name: README file Output Test
run: echo ${{ steps.readme_file.outputs.file_exists }}
- name: README file exists with content
if: steps.readme_file.outputs.file_exists == 'true'
run: echo README file exists!
- name: README file does not exist
if: steps.readme_file.outputs.file_exists == 'false'
run: echo README file does not exist!
check-for-license:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Check for LICENSE
id: license_file
uses: initialstate/file-check-action@v1
with:
file: LICENSE
- name: LICENSE file Output Test
run: echo ${{ steps.license_file.outputs.file_exists }}
- name: LICENSE file exists with content
if: steps.license_file.outputs.file_exists == 'true'
run: echo LICENSE file exists!
- name: LICENSE file does not exist
if: steps.license_file.outputs.file_exists == 'false'
run: echo LICENSE file does not exist!
check-for-dependabot-file:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Check for dependabot.yml
id: dependabot_file
uses: initialstate/file-check-action@v1
with:
file: .github/dependabot.yml
- name: dependabot.yml file Output Test
run: echo ${{ steps.dependabot_file.outputs.file_exists }}
- name: dependabot file exists with content
if: steps.dependabot_file.outputs.file_exists == 'true'
run: echo dependabot file exists!
- name: dependabot file does not exist
if: steps.dependabot_file.outputs.file_exists == 'false'
run: echo dependabot file does not exist!
check-for-codeql-file:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Check for codeql-analysis.yml
id: codeql-analysis_file
uses: initialstate/file-check-action@v1
with:
file: .github/workflows/codeql-analysis.yml
- name: codeql-analysis.yml file Output Test
run: echo ${{ steps.codeql-analysis_file.outputs.file_exists }}
- name: codeql-analysis file exists with content
if: steps.codeql-analysis_file.outputs.file_exists == 'true'
run: echo codeql-analysis file exists!
- name: codeql-analysis file does not exist
if: steps.codeql-analysis_file.outputs.file_exists == 'false'
run: echo codeql-analysis file does not exist!
# Check that all jobs passed
check-repo-lint-passed:
if: ${{ !cancelled() }}
needs:
- check-for-codeowners-file
- check-for-readme-file
- check-for-license
- check-for-dependabot-file
- check-for-codeql-file
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}