Skip to content

Commit 80e333e

Browse files
authored
Use github app for codeowners validation (#116)
* Use github app for codeowners validation * Update ci-codeowners.yml * Update ci-codeowners.yml
1 parent cb0bbc4 commit 80e333e

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

.github/workflows/ci-codeowners.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ name: |-
1414
uses: cloudposse/github-actions-workflows/.github/workflows/ci-codeowners-full.yml@main
1515
with:
1616
is_fork: $\{\{ github.event.pull_request.head.repo.full_name != github.repository \}\}
17+
secrets: inherit
1718
```
1819
on:
1920
workflow_call:
@@ -27,36 +28,48 @@ on:
2728
type: string
2829
required: false
2930
default: '["ubuntu-latest"]'
30-
secrets:
31-
github_access_token:
32-
description: "GitHub API token"
33-
required: false
3431

3532
jobs:
36-
validate:
33+
syntax:
3734
runs-on: ${{ fromJSON(inputs.runs-on) }}
38-
name: "Codeowners validate"
35+
name: Validate Codeowners (syntax)
3936
steps:
4037
- name: Checkout
4138
uses: actions/checkout@v4
4239

4340
- uses: mszostok/[email protected]
4441
# Pull request from a fork
4542
name: "Validate CODEOWNERS"
46-
if: ${{ inputs.is_fork }}
4743
with:
4844
checks: "syntax,duppatterns"
4945
owner_checker_allow_unowned_patterns: "false"
5046

51-
- uses: mszostok/[email protected]
47+
owners:
48+
runs-on: ${{ fromJSON(inputs.runs-on) }}
49+
name: Validate Codeowners (owners)
50+
if: ${{ false && ! inputs.is_fork }}
51+
environment: release
52+
steps:
53+
- uses: actions/create-github-app-token@v1
54+
id: github-app
55+
with:
56+
app-id: ${{ vars.BOT_GITHUB_APP_ID }}
57+
private-key: ${{ secrets.BOT_GITHUB_APP_PRIVATE_KEY }}
58+
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
with:
62+
token: ${{ steps.github-app.outputs.token }}
63+
64+
- uses: mszostok/[email protected]
5265
# Main branch / Pull request from the same repo
5366
name: "Validate CODEOWNERS"
54-
if: ${{ ! inputs.is_fork }}
5567
with:
5668
# For now, remove "files" check to allow CODEOWNERS to specify non-existent
5769
# files so we can use the same CODEOWNERS file for Terraform and non-Terraform repos
5870
# checks: "files,syntax,owners,duppatterns"
59-
checks: "syntax,duppatterns,owners"
71+
checks: "owners"
6072
owner_checker_allow_unowned_patterns: "false"
6173
# Admin GitHub access token is required only if the `owners` check is enabled
62-
github_access_token: "${{ secrets.github_access_token }}"
74+
github_access_token: ${{ steps.github-app.outputs.token }}
75+

0 commit comments

Comments
 (0)