Skip to content

Commit c1bb76d

Browse files
[WIP] add initial version
0 parents  commit c1bb76d

19 files changed

+3831
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Archetypically

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
name: CI
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
revision:
8+
description: 'The revision to run CI on.'
9+
required: false
10+
default: main
11+
push:
12+
branches:
13+
- main
14+
pull_request:
15+
branches:
16+
- main
17+
18+
permissions:
19+
contents: read
20+
pull-requests: read
21+
22+
jobs:
23+
ci:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
with:
29+
ref: ${{ github.event.inputs.revision }}
30+
31+
- name: Setup node
32+
uses: actions/setup-node@v3
33+
with:
34+
node-version: 16
35+
cache: 'yarn'
36+
37+
- name: Install dependencies
38+
run: yarn install --frozen-lockfile
39+
40+
- name: Run format checks
41+
if: success() || failure()
42+
run: 'yarn format:check'
43+
44+
- name: Run linter
45+
if: success() || failure()
46+
run: 'yarn lint:check'
47+
48+
- name: Run tests
49+
if: success() || failure()
50+
env:
51+
NODE_ENV: test
52+
run: 'yarn test:ci'
53+
54+
package-action:
55+
runs-on: ubuntu-latest
56+
needs:
57+
- ci
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v3
61+
with:
62+
ref: ${{ github.event.inputs.revision }}
63+
64+
- name: Setup node
65+
uses: actions/setup-node@v3
66+
with:
67+
node-version: 16
68+
cache: 'yarn'
69+
70+
- name: Install dependencies
71+
run: yarn install --frozen-lockfile
72+
73+
- name: Package action
74+
run: yarn ci:package
75+
76+
- name: Commit changes
77+
uses: stefanzweifel/git-auto-commit-action@v4
78+
with:
79+
commit_message: 'chore: Package action'
80+
commit_options: '--no-verify --signoff'
81+
file_pattern: dist/
82+
disable_globbing: true
83+
push_options: '--force'

.gitignore

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
93+
# Gatsby files
94+
.cache/
95+
# Comment in the public line in if your project uses Gatsby and not Next.js
96+
# https://nextjs.org/blog/next-9-1#public-directory-support
97+
# public
98+
99+
# vuepress build output
100+
.vuepress/dist
101+
102+
# vuepress v2.x temp and cache directory
103+
.temp
104+
.cache
105+
106+
# Docusaurus cache and generated files
107+
.docusaurus
108+
109+
# Serverless directories
110+
.serverless/
111+
112+
# FuseBox cache
113+
.fusebox/
114+
115+
# DynamoDB Local files
116+
.dynamodb/
117+
118+
# TernJS port file
119+
.tern-port
120+
121+
# Stores VSCode versions used for testing VSCode extensions
122+
.vscode-test
123+
124+
# yarn v2
125+
.yarn/cache
126+
.yarn/unplugged
127+
.yarn/build-state.yml
128+
.yarn/install-state.gz
129+
.pnp.*

.yamllint.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
extends: default
3+
4+
ignore: |
5+
**/node_modules/**/*.yml
6+
7+
rules:
8+
line-length:
9+
max: 120
10+
level: warning
11+
indentation:
12+
indent-sequences: whatever
13+
truthy: disable

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Evan Lee
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# add-write-permissions-for-codeowners
2+
3+
[![CI](https://github.com/Archetypically/add-write-permissions-for-codeowners/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Archetypically/add-write-permissions-for-codeowners/actions/workflows/ci.yml)
4+
5+
This GitHub Action will add write permissions for the missing entries in the CODEOWNERS file.
6+
7+
## Usage
8+
9+
### Example
10+
11+
```yaml
12+
---
13+
name: Format CODEOWNERS
14+
15+
on:
16+
push:
17+
branches:
18+
- main
19+
paths:
20+
- 'CODEOWNERS'
21+
22+
jobs:
23+
add-write-permissions-for-codeowners:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- uses: Archetypically/add-write-permissions-for-codeowners@v1
29+
id: add-write-permissions-for-codeowners
30+
with:
31+
# Optional. The path to the CODEOWNERS file to format. Will auto-detect if not passed in.
32+
file-path: CODEOWNERS
33+
34+
# Optional. Whether or not to actually perform the permissions update. Defaults to false.
35+
dry-run: false
36+
```
37+
38+
### Parameters
39+
40+
| Name | Description | Default |
41+
| --- | --- | --- |
42+
| `file-path` | The path to the CODEOWNERS file to format. Will auto-detect if not passed in. | `CODEOWNERS` |
43+
| `dry-run` | Whether or not to actually perform the permissions update. | `false` |
44+
45+
## Development
46+
47+
_This repository intentionally does not use `act` for local development to reduce complexity._
48+
49+
Inputs are controlled via environment variables defined in `development/.env.development`.
50+
51+
Run the action using:
52+
53+
```shell
54+
yarn action
55+
```
56+
57+
which will operate on the file at `development/CODEOWNERS`.
58+
59+
Run the tests using:
60+
61+
```shell
62+
yarn test
63+
```
64+
65+
## Credits
66+
67+
- [Evan Lee](https://evanlee.engineer) ([@Archetypically](https://github.com/Archetypically))
68+
69+
## License
70+
71+
This project is licensed under the MIT License - see the [`LICENSE`](LICENSE) file for details.

action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: 'Add write permissions for CODEOWNERS'
3+
author: 'Evan Lee <@Archetypically>'
4+
5+
description: Add missing write permissions for CODEOWNERS.
6+
7+
branding:
8+
icon: sliders
9+
color: green
10+
11+
inputs:
12+
file-path:
13+
description: |
14+
The path to the CODEOWNERS file to operate on.
15+
Otherwise searches for valid CODEOWNERS files as described in:
16+
https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-file-location.
17+
required: false
18+
default: CODEOWNERS
19+
dry-run:
20+
description: Whether or not to actually make the updates
21+
required: false
22+
default: false
23+
24+
github-token:
25+
description: A token to use for authenticating to GitHub.
26+
required: true
27+
28+
outputs:
29+
added-permissions-for:
30+
description: |
31+
A space-separated list of usernames or team names that had their permissions updated.
32+
runs:
33+
using: 'node16'
34+
main: 'dist/index.js'

0 commit comments

Comments
 (0)