mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-19 10:15:59 +08:00
fix: token
This commit is contained in:
@@ -49,7 +49,7 @@ export class IssueHelperEngine implements IIssueHelperEngine {
|
||||
private owner!: string;
|
||||
private repo!: string;
|
||||
private issueNumber!: number;
|
||||
private githubToken!: string;
|
||||
private token?: string | void;
|
||||
|
||||
private emoji?: string;
|
||||
private labels?: string[] | void;
|
||||
@@ -89,7 +89,7 @@ export class IssueHelperEngine implements IIssueHelperEngine {
|
||||
return;
|
||||
}
|
||||
|
||||
this.githubToken = core.getInput('token', { required: true }) as string;
|
||||
this.token = core.getInput('token');
|
||||
this.emoji = core.getInput('emoji') || '';
|
||||
this.labels = dealStringToArr(core.getInput('labels') || '');
|
||||
|
||||
@@ -104,12 +104,12 @@ export class IssueHelperEngine implements IIssueHelperEngine {
|
||||
}
|
||||
|
||||
private initIssueCore() {
|
||||
const { owner, repo, issueNumber, githubToken } = this;
|
||||
const { owner, repo, issueNumber, token } = this;
|
||||
this.ICE = new IssueCoreEngine({
|
||||
owner,
|
||||
repo,
|
||||
issueNumber,
|
||||
githubToken,
|
||||
token,
|
||||
});
|
||||
core.info(`[Init] [${owner}/${repo}] [${issueNumber}]`);
|
||||
}
|
||||
|
@@ -7,17 +7,16 @@ export class IssueCoreEngine implements IIssueCoreEngine {
|
||||
private owner!: string;
|
||||
private repo!: string;
|
||||
private issueNumber!: number;
|
||||
private githubToken!: string;
|
||||
|
||||
private octokit!: Octokit;
|
||||
|
||||
public constructor(_info: IIssueBaseInfo) {
|
||||
if (_info.owner && _info.repo && _info.githubToken) {
|
||||
Object.assign(this, _info);
|
||||
const octokit = new Octokit({ auth: `token ${this.githubToken}` });
|
||||
this.octokit = octokit;
|
||||
if (_info.owner && _info.repo) {
|
||||
this.owner = _info.owner;
|
||||
this.repo = _info.repo;
|
||||
this.issueNumber = _info.issueNumber;
|
||||
this.octokit = new Octokit({ auth: `token ${_info.token}` });
|
||||
} else {
|
||||
console && console.error && console.error(`Init failed, need owner、repo and token!`);
|
||||
console && console.error && console.error(`Init failed, need owner、repo!`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@ export interface IIssueBaseInfo {
|
||||
owner: string;
|
||||
repo: string;
|
||||
issueNumber: number;
|
||||
githubToken: string;
|
||||
token?: string | void;
|
||||
}
|
||||
|
||||
export interface IListIssuesParams {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { dealStringToArr, THANKS } from 'actions-util';
|
||||
|
||||
import * as github from '@actions/github';
|
||||
import { dealStringToArr, THANKS } from 'actions-util';
|
||||
|
||||
import * as core from './core';
|
||||
import { IssueHelperEngine } from './helper';
|
||||
|
Reference in New Issue
Block a user