owner option

This commit is contained in:
marocchino 2023-02-11 20:09:54 +09:00
parent c0d3b93c09
commit 0bd1af949c
No known key found for this signature in database
GPG key ID: DEFF05E6B5B0FF97
6 changed files with 14 additions and 5 deletions

View file

@ -191,6 +191,10 @@ is explicitly passed, this problem can be solved by just removing it.
**Optional** Pull request number for push event. Note that this has a **lower priority** than the number of a pull_request event.
### `owner`
**Optional** Another repository owner, If not set, the current repository owner is used by default. Note that when you trying changing a repo, be aware that `GITHUB_TOKEN` should also have permission for that repository.
### `repo`
**Optional** Another repository name. Of limited use on GitHub enterprise. If not set, the current repository is used by default. Note that when you trying changing a repo, be aware that `GITHUB_TOKEN` should also have permission for that repository.

View file

@ -18,6 +18,7 @@ beforeEach(() => {
afterEach(() => {
jest.resetModules()
delete process.env["GITHUB_REPOSITORY"]
delete process.env["INPUT_OWNER"]
delete process.env["INPUT_REPO"]
delete process.env["INPUT_HEADER"]
delete process.env["INPUT_MESSAGE"]
@ -38,10 +39,11 @@ afterEach(() => {
})
test("repo", async () => {
process.env["INPUT_OWNER"] = "jin"
process.env["INPUT_REPO"] = "other"
expect(require("../src/config")).toMatchObject({
pullRequestNumber: expect.any(Number),
repo: {owner: "marocchino", repo: "other"},
repo: {owner: "jin", repo: "other"},
header: "",
append: false,
recreate: false,

View file

@ -59,8 +59,11 @@ inputs:
number:
description: "pull request number for push event"
required: false
owner:
description: "Another repo owner, If not set, the current repo owner is used by default. Note that when you trying changing a repo, be aware that GITHUB_TOKEN should also have permission for that repository."
required: false
repo:
description: "other repo name limited use on github enterprise. If not set, the current repo is used by default. Note that When you trying changing a repo, be aware that GITHUB_TOKEN should also use that repo's."
description: "Another repo name limited use on github enterprise. If not set, the current repo is used by default. Note that When you trying changing a repo, be aware that GITHUB_TOKEN should also use that repo's."
required: false
GITHUB_TOKEN:
description: "The GitHub access token (e.g. secrets.GITHUB_TOKEN) used to create or update the comment. This defaults to {{ github.token }}."

2
dist/index.js generated vendored
View file

@ -241,7 +241,7 @@ exports.ignoreEmpty = core.getBooleanInput("ignore_empty", {
});
function buildRepo() {
return {
owner: github_1.context.repo.owner,
owner: core.getInput("owner", { required: false }) || github_1.context.repo.owner,
repo: core.getInput("repo", { required: false }) || github_1.context.repo.repo
};
}

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -36,7 +36,7 @@ export const ignoreEmpty = core.getBooleanInput("ignore_empty", {
function buildRepo(): {repo: string; owner: string} {
return {
owner: context.repo.owner,
owner: core.getInput("owner", {required: false}) || context.repo.owner,
repo: core.getInput("repo", {required: false}) || context.repo.repo
}
}