Skip to content

Commit 8f3a6ec

Browse files
authored
feat: codeowners-analysis action (#1218)
* feat: codeowners-analysis action * fix: overall status * rername to codeowners-review-analysis * feat: rework processing and displaying * fix: pull codeowners file from default branch * docs: update README * add changeset * fix: link formatting * fix: link location * fix: remove unnecessary method * fix: more formatting tweaks * fix: add retry instructions
1 parent 262e8fe commit 8f3a6ec

26 files changed

Lines changed: 58565 additions & 144 deletions

.changeset/orange-hairs-march.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"codeowners-review-analysis": minor
3+
---
4+
5+
initial commit
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Codeowners Analysis
2+
3+
Analyzes changed files for a given PR, and displays current CODEOWNER
4+
requirements.
5+
6+
## Acknowledgement
7+
8+
The CODEOWNERS parsing contained in this repo was translated from:
9+
https://github.com/hmarr/codeowners
10+
11+
## Usage
12+
13+
### Inputs
14+
15+
| input | description | default |
16+
| -------------- | ----------------------------------------------------------------------------- | ------- |
17+
| `post-comment` | Whether to post a small comment on the PR summarizing codeowners requirements | `true` |
18+
19+
### Example Workflow
20+
21+
```yaml
22+
name: Codeowners Analysis Test
23+
on:
24+
workflow_dispatch:
25+
pull_request:
26+
paths:
27+
- .github/workflows/codeowners-analysis.yml
28+
jobs:
29+
analyze-changes:
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read # needed to read codeowners file
33+
pull-requests: read # needed to comment on PRs
34+
actions: read # needed to get summary url
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v5
38+
with:
39+
fetch-depth: 1
40+
- name: Run Codeowners Analysis
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
uses: smartcontractkit/.github/actions/codeowners-review-analysis@<tag>
44+
```
45+
46+
## Development
47+
48+
### Generated Types
49+
50+
See [src/generated/README.md](./src/generated/README.md) for more details.
51+
52+
### Local Testing
53+
54+
From the root of the `.github` repository, you can run
55+
`./actions/codeowners-review-analysis/scripts/test.sh` to run tests.
56+
57+
- Update both `test.sh` and `payload.json` for your test case
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: codeowners-review-analysis
2+
description:
3+
"Analyzes changed files for a given PR, and displays codeowners required based
4+
on paths."
5+
6+
runs:
7+
using: "node20"
8+
main: "dist/index.js"
9+
10+
inputs:
11+
post-comment:
12+
description:
13+
"Whether to post a comment on the PR with the analysis results."
14+
required: false
15+
default: "true"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"schema": "./node_modules/@octokit/graphql-schema/schema.graphql",
3+
"generates": {
4+
"./src/generated/graphql.ts": {
5+
"plugins": ["typescript", "typescript-operations"]
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)