Skip to content

Commit 48ae1f7

Browse files
committed
Allow different codeowner roots
1 parent a207cdf commit 48ae1f7

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Orta Therox
1+
Copyright (c) 2019-Present Orta Therox
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@ packages/typescriptlang-org/src/copy/es/**/*.ts @KingDarBoja [translate] [es]
7272
packages/documentation/copy/es/**/*.ts @KingDarBoja [translate] [es]
7373
```
7474

75+
## Config
76+
77+
There is only one option available ATM, `cwd` which can be used to determine the root folder to look for CODEOWNER files in:
78+
79+
```yml
80+
- name: Run Codeowners merge check
81+
uses: orta/code-owner-self-merge@v1
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
with:
85+
cwd: './docs'
86+
```
87+
7588
### Dev
7689

7790
Use `npx jest --watch` to run tests.

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ branding:
66
icon: git-merge
77
color: purple
88

9+
inputs:
10+
cwd:
11+
description: 'The path to the root folder where it should look for code owners'
12+
default: ''
13+
914
runs:
1015
using: 'node12'
1116
main: 'index.js'

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const {readFileSync} = require("fs")
77

88
// Effectively the main function
99
async function run() {
10-
core.info("Running version 1.4.1")
10+
core.info("Running version 1.4.2")
1111

1212
// Tell folks they can merge
1313
if (context.eventName === "pull_request_target") {
@@ -26,7 +26,7 @@ async function commentOnMergablePRs() {
2626
}
2727

2828
// Setup
29-
const cwd = process.cwd()
29+
const cwd = core.getInput('cwd') || process.cwd()
3030
const octokit = getOctokit(process.env.GITHUB_TOKEN)
3131
const pr = context.payload.pull_request
3232
const thisRepo = { owner: context.repo.owner, repo: context.repo.repo }
@@ -97,7 +97,7 @@ async function mergeIfLGTMAndHasAccess() {
9797
}
9898

9999
// Setup
100-
const cwd = process.cwd()
100+
const cwd = core.getInput('cwd') || process.cwd()
101101
const octokit = getOctokit(process.env.GITHUB_TOKEN)
102102
const thisRepo = { owner: context.repo.owner, repo: context.repo.repo }
103103
const issue = context.payload.issue || context.payload.pull_request

0 commit comments

Comments
 (0)