Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/orange-hairs-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"codeowners-review-analysis": minor
---

initial commit
57 changes: 57 additions & 0 deletions actions/codeowners-review-analysis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Codeowners Analysis

Analyzes changed files for a given PR, and displays current CODEOWNER
requirements.

## Acknowledgement

The CODEOWNERS parsing contained in this repo was translated from:
https://github.com/hmarr/codeowners

## Usage

### Inputs

| input | description | default |
| -------------- | ----------------------------------------------------------------------------- | ------- |
| `post-comment` | Whether to post a small comment on the PR summarizing codeowners requirements | `true` |

### Example Workflow

```yaml
name: Codeowners Analysis Test
on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/codeowners-analysis.yml
jobs:
analyze-changes:
runs-on: ubuntu-latest
permissions:
contents: read # needed to read codeowners file
pull-requests: read # needed to comment on PRs
actions: read # needed to get summary url
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Run Codeowners Analysis
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: smartcontractkit/.github/actions/codeowners-review-analysis@<tag>
```

## Development

### Generated Types

See [src/generated/README.md](./src/generated/README.md) for more details.

### Local Testing

From the root of the `.github` repository, you can run
`./actions/codeowners-review-analysis/scripts/test.sh` to run tests.

- Update both `test.sh` and `payload.json` for your test case
15 changes: 15 additions & 0 deletions actions/codeowners-review-analysis/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: codeowners-review-analysis
description:
"Analyzes changed files for a given PR, and displays codeowners required based
on paths."

runs:
using: "node20"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using: "node20"
using: node24

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tested anything w/ node24 yet. Will leave this as node20 for now, and maybe we can update most of our actions to node24 in one big swoop.

main: "dist/index.js"

inputs:
post-comment:
description:
"Whether to post a comment on the PR with the analysis results."
required: false
default: "true"
8 changes: 8 additions & 0 deletions actions/codeowners-review-analysis/codegen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"schema": "./node_modules/@octokit/graphql-schema/schema.graphql",
"generates": {
"./src/generated/graphql.ts": {
"plugins": ["typescript", "typescript-operations"]
}
}
}
Loading
Loading