Skip to content

Commit 13ae5d6

Browse files
committed
Adds docs
1 parent 55d9f0a commit 13ae5d6

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

README.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,57 @@
1-
A GitHub action that lets code-owners merge code via GitHub reviews.
1+
A GitHub action that lets code-owners merge PRs via a comment.
2+
3+
This action uses the standardized structure of [a CODEOWNERS file](https://github.blog/2017-07-06-introducing-code-owners/) to handle the access controls.
4+
5+
## A simple example
6+
7+
So, with this file at: `.github/CODEOWNERS`:
8+
9+
```sh
10+
README.md @orta
11+
```
12+
13+
If a PR contained _only_ a change to the `README.md` - this action would say that "@orta has the ability to merge by commenting 'LGTM'".
14+
15+
Then, when/if this happens the GitHub Action will merge for you.
16+
17+
## A real-world example
18+
19+
`.github/CODEOWNERS`:
20+
21+
```sh
22+
# Collaborators for Japanese Translation of the Website
23+
packages/playground-examples/copy/ja/** @sasurau4 @Quramy @Naturalclar @Takepepe @orta
24+
packages/tsconfig-reference/copy/ja/** @sasurau4 @Quramy @Naturalclar @Takepepe @orta
25+
packages/typescriptlang-org/src/copy/ja/** @sasurau4 @Quramy @Naturalclar @Takepepe @orta
26+
packages/documentation/copy/ja/** @sasurau4 @Quramy @Naturalclar @Takepepe @orta
27+
```
28+
29+
This allows any of `@sasurau4`, `@Quramy`, `@Naturalclar`, `@Takepepe` or `@orta` to merge PRs which affect their areas of the translation process in the TypeScript Website repo.
30+
31+
## Setting It Up
32+
33+
You want a unique workflow file, e.g. `.github/workflows/codeowners-merge.yml`
234

335
```yml
4-
name: Example Workflow
36+
name: Codeowners merging
537
on:
638
pull_request_target:
739
issue_comment: { types: created }
840

941
jobs:
1042
build:
11-
1243
runs-on: ubuntu-latest
13-
44+
1445
steps:
1546
- uses: actions/checkout@v1
16-
- name: Runs this workflow
47+
- name: Run Codeowners merge check
1748
env:
1849
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1950
uses: orta/code-organizer-merge-on-green@master
51+
```
2052
53+
Then you should be good to go.
2154
22-
```
55+
### Security
56+
57+
We force the use of [`pull_request_target`](https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/) as a workflow event to ensure that someone cannot change the CODEOWNER files at the same time as having that change be used to validate if they can merge.

0 commit comments

Comments
 (0)