feat: support custom repo (#83)

This commit is contained in:
xrkffgg
2021-08-15 19:55:45 +08:00
committed by GitHub
parent f76bae5b37
commit dc4a7a3ca8
2 changed files with 13 additions and 1 deletions

View File

@@ -13,6 +13,9 @@ inputs:
token: token:
description: 'Github_token' description: 'Github_token'
default: ${{ github.token }} default: ${{ github.token }}
repo:
description: 'The repositorie'
issue-number: issue-number:
description: 'Issue-number' description: 'Issue-number'
comment-id: comment-id:

View File

@@ -65,7 +65,16 @@ const ALLACTIONS = [
async function main() { async function main() {
try { try {
const ctx = github.context; const ctx = github.context;
const { owner, repo } = ctx.repo;
// No display to outside
let owner, repo;
if (core.getInput('repo')) {
owner = core.getInput('repo').split('/')[0];
repo = core.getInput('repo').split('/')[1];
} else {
owner = ctx.repo.owner;
repo = ctx.repo.repo;
}
let defaultNo; let defaultNo;
if (ctx.eventName === 'issues') defaultNo = ctx.payload.issue.number; if (ctx.eventName === 'issues') defaultNo = ctx.payload.issue.number;