|
| 1 | +--- |
1 | 2 | name: tek-repo-lint |
2 | 3 | on: |
3 | 4 | push: |
4 | | - branches: [ "main" ] |
| 5 | + branches: [master] |
5 | 6 | pull_request: |
6 | | - branches: [ "main" ] |
| 7 | + branches: [master] |
7 | 8 | workflow_dispatch: |
8 | 9 |
|
9 | | -# select correct state for repository |
10 | | -env: |
11 | | - # state: private |
12 | | - state: public |
13 | | - |
14 | 10 | jobs: |
15 | | - public-or-private-repo: |
16 | | - runs-on: ubuntu-latest |
17 | | - outputs: |
18 | | - repostate: ${{ steps.repo-state.outputs.repostate }} |
19 | | - steps: |
20 | | - |
21 | | - - name: Repo state |
22 | | - id: repo-state |
23 | | - run: echo "repostate=${{env.state}}" >> $GITHUB_OUTPUT |
24 | | - - name: Repo public? |
25 | | - if: "${{ env.state == 'public' }}" |
26 | | - run: echo "Workflow has repo set as public. If this is incorrect, uncomment line 11." |
27 | | - - name: Repo private? |
28 | | - if: "${{ env.state == 'private' }}" |
29 | | - run: echo "Workflow has repo set as private. If this is incorrect, uncomment line 12." |
30 | | - |
31 | | - check-for-codeowners-file: |
32 | | - runs-on: ubuntu-latest |
33 | | - steps: |
34 | | - |
35 | | - - name: Checkout repo |
36 | | - uses: actions/checkout@v3 |
37 | | - |
38 | | - - name: Check for CODEOWNERS |
39 | | - id: codeowners_file |
40 | | - uses: initialstate/file-check-action@v1 |
41 | | - with: |
42 | | - file: ".github/CODEOWNERS" |
43 | | - |
44 | | - - name: CODEOWNERS file Output Test |
45 | | - run: echo ${{ steps.codeowners_file.outputs.file_exists }} |
46 | | - |
47 | | - - name: CODEOWNERS file exists with content |
48 | | - if: steps.codeowners_file.outputs.file_exists == 'true' |
49 | | - run: echo CODEOWNERS file exists! |
50 | | - |
51 | | - - name: CODEOWNERS file does not exist |
52 | | - if: steps.codeowners_file.outputs.file_exists == 'false' |
53 | | - run: echo CODEOWNERS file does not exist! |
54 | | - |
55 | | - check-for-readme-file: |
56 | | - runs-on: ubuntu-latest |
57 | | - steps: |
58 | | - |
59 | | - - name: Checkout repo |
60 | | - uses: actions/checkout@v3 |
61 | | - |
62 | | - - name: Check for README.md |
63 | | - id: readme_file |
64 | | - uses: initialstate/file-check-action@v1 |
65 | | - with: |
66 | | - file: "README" |
67 | | - |
68 | | - - name: README file Output Test |
69 | | - run: echo ${{ steps.readme_file.outputs.file_exists }} |
70 | | - |
71 | | - - name: README file exists with content |
72 | | - if: steps.readme_file.outputs.file_exists == 'true' |
73 | | - run: echo README file exists! |
74 | | - |
75 | | - - name: README file does not exist |
76 | | - if: steps.readme_file.outputs.file_exists == 'false' |
77 | | - run: echo README file does not exist! |
78 | | - |
79 | | - check-for-license: |
80 | | - needs: public-or-private-repo |
81 | | - if: needs.public-or-private-repo.outputs.repostate == 'public' |
| 11 | + check-for-file: |
82 | 12 | runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + filename: |
| 17 | + - .github/CODEOWNERS |
| 18 | + - README.@(md|rst) |
| 19 | + - LICENSE.@(md|rst) |
| 20 | + - .github/workflows/codeql.yml |
83 | 21 | steps: |
84 | | - |
85 | | - - name: Checkout repo |
86 | | - uses: actions/checkout@v3 |
87 | | - |
88 | | - - name: Check for LICENSE.md |
89 | | - id: license_file |
90 | | - uses: initialstate/file-check-action@v1 |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - name: Ensure ${{ matrix.filename }} exists |
| 24 | + uses: andstor/file-existence-action@v3 |
91 | 25 | with: |
92 | | - file: "LICENSE" |
93 | | - |
94 | | - - name: LICENSE file Output Test |
95 | | - run: echo ${{ steps.license_file.outputs.file_exists }} |
96 | | - |
97 | | - - name: LICENSE file exists with content |
98 | | - if: steps.license_file.outputs.file_exists == 'true' |
99 | | - run: echo LICENSE file exists! |
100 | | - |
101 | | - - name: LICENSE file does not exist |
102 | | - if: steps.license_file.outputs.file_exists == 'false' |
103 | | - run: echo LICENSE file does not exist! |
104 | | - |
105 | | - check-for-dependabot-file: |
| 26 | + files: ${{ matrix.filename }} |
| 27 | + ignore_case: false |
| 28 | + follow_symbolic_links: false |
| 29 | + fail: true # Set the step to fail if the file doesn't exist |
| 30 | + # Check that all jobs passed |
| 31 | + check-repo-lint-passed: |
| 32 | + if: ${{ !cancelled() }} |
| 33 | + needs: [check-for-file] |
106 | 34 | runs-on: ubuntu-latest |
107 | 35 | steps: |
108 | | - |
109 | | - - name: Checkout repo |
110 | | - uses: actions/checkout@v3 |
111 | | - |
112 | | - - name: Check for dependabot.yml |
113 | | - id: dependabot_file |
114 | | - uses: initialstate/file-check-action@v1 |
| 36 | + - name: Decide whether the needed jobs succeeded or failed |
| 37 | + uses: re-actors/alls-green@release/v1 |
115 | 38 | with: |
116 | | - file: ".github/dependabot.yml" |
117 | | - |
118 | | - - name: dependabot.yml file Output Test |
119 | | - run: echo ${{ steps.dependabot_file.outputs.file_exists }} |
120 | | - |
121 | | - - name: dependabot file exists with content |
122 | | - if: steps.dependabot_file.outputs.file_exists == 'true' |
123 | | - run: echo dependabot file exists! |
124 | | - |
125 | | - - name: dependabot file does not exist |
126 | | - if: steps.dependabot_file.outputs.file_exists == 'false' |
127 | | - run: echo dependabot file does not exist! |
128 | | - |
129 | | - check-for-codeql-file: |
130 | | - runs-on: ubuntu-latest |
131 | | - steps: |
132 | | - |
133 | | - - name: Checkout repo |
134 | | - uses: actions/checkout@v3 |
135 | | - |
136 | | - - name: Check for codeql-analysis.yml |
137 | | - id: codeql-analysis_file |
138 | | - uses: initialstate/file-check-action@v1 |
139 | | - with: |
140 | | - file: ".github/workflows/codeql-analysis.yml" |
141 | | - |
142 | | - - name: codeql-analysis.yml file Output Test |
143 | | - run: echo ${{ steps.codeql-analysis_file.outputs.file_exists }} |
144 | | - |
145 | | - - name: codeql-analysis file exists with content |
146 | | - if: steps.codeql-analysis_file.outputs.file_exists == 'true' |
147 | | - run: echo codeql-analysis file exists! |
148 | | - |
149 | | - - name: codeql-analysis file does not exist |
150 | | - if: steps.codeql-analysis_file.outputs.file_exists == 'false' |
151 | | - run: echo codeql-analysis file does not exist! |
| 39 | + jobs: ${{ toJSON(needs) }} |
0 commit comments