mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-19 10:15:59 +08:00
feat: add get-issue
(#114)
* feat: add get-issue * optimize code * fix * t * ttt * revert * revert Co-authored-by: 元凛 <xrkffgg@vip.qq.com>
This commit is contained in:
12
action.yml
12
action.yml
@@ -96,7 +96,17 @@ inputs:
|
||||
|
||||
outputs:
|
||||
issue-number:
|
||||
description: 'Create Issue Number'
|
||||
description: 'Issue Number'
|
||||
issue-title:
|
||||
description: 'Issue Title'
|
||||
issue-body:
|
||||
description: 'Issue Body'
|
||||
issue-labels:
|
||||
description: 'Issue labels'
|
||||
issue-assignees:
|
||||
description: 'Issue assignees'
|
||||
issue-state:
|
||||
description: 'Issue state'
|
||||
comment-id:
|
||||
description: 'Create comment ID'
|
||||
comments:
|
||||
|
20
dist/index.js
vendored
20
dist/index.js
vendored
@@ -15014,7 +15014,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.doUpdateIssue = exports.doUpdateComment = exports.doUnlockIssue = exports.doSetLabels = exports.doRemoveLabels = exports.doRemoveAssignees = exports.doOpenIssue = exports.doLockIssue = exports.doDeleteComment = exports.doCreateLabel = exports.doCreateIssue = exports.doCreateCommentEmoji = exports.doCreateComment = exports.doCloseIssue = exports.doAddLabels = exports.doAddAssignees = exports.initBaseICE = void 0;
|
||||
exports.doUpdateIssue = exports.doUpdateComment = exports.doUnlockIssue = exports.doSetLabels = exports.doRemoveLabels = exports.doRemoveAssignees = exports.doOpenIssue = exports.doLockIssue = exports.doGetIssue = exports.doDeleteComment = exports.doCreateLabel = exports.doCreateIssue = exports.doCreateCommentEmoji = exports.doCreateComment = exports.doCloseIssue = exports.doAddLabels = exports.doAddAssignees = exports.initBaseICE = void 0;
|
||||
const actions_util_1 = __nccwpck_require__(6972);
|
||||
const core = __importStar(__nccwpck_require__(9875));
|
||||
const shared_1 = __nccwpck_require__(3826);
|
||||
@@ -15125,6 +15125,20 @@ function doDeleteComment(_commentId) {
|
||||
});
|
||||
}
|
||||
exports.doDeleteComment = doDeleteComment;
|
||||
function doGetIssue() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { number, title, body, state, labels, assignees } = yield ICE.getIssue();
|
||||
core.setOutput('issue-number', number);
|
||||
core.setOutput('issue-title', title || '');
|
||||
core.setOutput('issue-body', body || '');
|
||||
core.setOutput('issue-state', state);
|
||||
const labelsString = labels.length ? labels.map(({ name }) => name).join(',') : '';
|
||||
core.setOutput('issue-labels', labelsString);
|
||||
const assigneesString = assignees.length ? assignees.map(({ login }) => login).join(',') : '';
|
||||
core.setOutput('issue-body', assigneesString);
|
||||
});
|
||||
}
|
||||
exports.doGetIssue = doGetIssue;
|
||||
function doLockIssue(issueNumber) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (issueNumber)
|
||||
@@ -15345,6 +15359,10 @@ class IssueHelperEngine {
|
||||
yield (0, base_1.doDeleteComment)();
|
||||
break;
|
||||
}
|
||||
case 'get-issue': {
|
||||
yield (0, base_1.doGetIssue)();
|
||||
break;
|
||||
}
|
||||
case 'lock-issue': {
|
||||
yield (0, base_1.doLockIssue)();
|
||||
break;
|
||||
|
@@ -19,6 +19,8 @@
|
||||
"format-check": "prettier --check **/*.ts **/*/*.ts",
|
||||
"lint": "eslint src/*.ts src/*/*.ts",
|
||||
"lint-fix": "eslint src/*.ts src/*/*.ts --fix",
|
||||
"lint-up": "npm run format && npm run lint-fix",
|
||||
"lint-all": "npm run format-check && npm run lint",
|
||||
"check-commit": "node ./scripts/check-commit.js",
|
||||
"tag": "node ./scripts/tag.js",
|
||||
"release": "node ./scripts/release",
|
||||
@@ -27,7 +29,7 @@
|
||||
"users": "node ./scripts/update-users.js",
|
||||
"version": "node ./scripts/update-version.js",
|
||||
"pub": "sh -e ./scripts/pub.sh",
|
||||
"all": "npm run format-check && npm run lint && npm run test && npm run package"
|
||||
"all": "npm run lint-all && npm run test && npm run package"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
|
@@ -95,6 +95,19 @@ export async function doDeleteComment(_commentId: number | void) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function doGetIssue() {
|
||||
const { number, title, body, state, labels, assignees } = await ICE.getIssue();
|
||||
|
||||
core.setOutput('issue-number', number);
|
||||
core.setOutput('issue-title', title || '');
|
||||
core.setOutput('issue-body', body || '');
|
||||
core.setOutput('issue-state', state);
|
||||
const labelsString = labels.length ? labels.map(({ name }) => name).join(',') : '';
|
||||
core.setOutput('issue-labels', labelsString);
|
||||
const assigneesString = assignees.length ? assignees.map(({ login }) => login).join(',') : '';
|
||||
core.setOutput('issue-body', assigneesString);
|
||||
}
|
||||
|
||||
export async function doLockIssue(issueNumber?: number) {
|
||||
if (issueNumber) ICE.setIssueNumber(issueNumber);
|
||||
const lockReason = (core.getInput('lock-reason') || '') as TLockReasons;
|
||||
|
@@ -25,6 +25,7 @@ import {
|
||||
doCreateIssue,
|
||||
doCreateLabel,
|
||||
doDeleteComment,
|
||||
doGetIssue,
|
||||
doLockIssue,
|
||||
doOpenIssue,
|
||||
doRemoveAssignees,
|
||||
@@ -159,6 +160,10 @@ export class IssueHelperEngine implements IIssueHelperEngine {
|
||||
await doDeleteComment();
|
||||
break;
|
||||
}
|
||||
case 'get-issue': {
|
||||
await doGetIssue();
|
||||
break;
|
||||
}
|
||||
case 'lock-issue': {
|
||||
await doLockIssue();
|
||||
break;
|
||||
|
@@ -2,12 +2,12 @@ import { Octokit } from '@octokit/rest';
|
||||
|
||||
import { EEmoji } from '../shared';
|
||||
import type {
|
||||
TCloseReason,
|
||||
TEmoji,
|
||||
TIssueState,
|
||||
TLockReasons,
|
||||
TUpdateMode,
|
||||
TUserPermission,
|
||||
TCloseReason,
|
||||
} from '../types';
|
||||
import type {
|
||||
IIssueBaseInfo,
|
||||
|
@@ -52,6 +52,7 @@ export type TAction =
|
||||
| 'close-issues'
|
||||
| 'find-comments'
|
||||
| 'find-issues'
|
||||
| 'get-issue'
|
||||
| 'lock-issues'
|
||||
| 'mark-assignees'
|
||||
| 'mark-duplicate'
|
||||
|
@@ -177,7 +177,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
|
||||
|
||||
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
|
||||
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
|
||||
### `find-issues`
|
||||
## `find-issues`
|
||||
|
||||
Find the current repository, the creator is k , the title contains `this` , the body contains `that`, and the list of issues in the open state.
|
||||
|
||||
|
Reference in New Issue
Block a user