mirror of
https://gitea.com/Lydanne/pr-extract-issues.git
synced 2025-08-23 12:09:19 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
78a8afb859 | ||
![]() |
dd11fb5133 | ||
![]() |
ae5b70b9f0 | ||
![]() |
ec59498db2 |
3
.github/workflows/extract-issues.yml
vendored
3
.github/workflows/extract-issues.yml
vendored
@@ -8,10 +8,11 @@ jobs:
|
|||||||
welcome:
|
welcome:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions-cool/pr-extract-issues@main
|
- uses: actions-cool/pr-extract-issues@t
|
||||||
with:
|
with:
|
||||||
way: 'commit'
|
way: 'commit'
|
||||||
issues-labels: 'l1, l2'
|
issues-labels: 'l1, l2'
|
||||||
|
filter-label: 'bug'
|
||||||
issues-comment: |
|
issues-comment: |
|
||||||
HI。这个 issue: ${number} 已经被修复了。
|
HI。这个 issue: ${number} 已经被修复了。
|
||||||
issues-close: true
|
issues-close: true
|
||||||
|
@@ -1,7 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v1.1.0
|
||||||
|
|
||||||
|
`2021.03.17`
|
||||||
|
|
||||||
|
- feat: add `filter-label`. [#19](https://github.com/actions-cool/pr-extract-issues/pull/19)
|
||||||
|
|
||||||
## v1.0.0
|
## v1.0.0
|
||||||
|
|
||||||
`2021.xx.xx`
|
`2021.03.12`
|
||||||
|
|
||||||
- 🎉 Init.
|
- 🎉 Init.
|
||||||
|
@@ -4,6 +4,8 @@
|
|||||||
[](https://github.com/marketplace/actions/pr-extract-issues)
|
[](https://github.com/marketplace/actions/pr-extract-issues)
|
||||||
[](https://github.com/actions-cool/pr-extract-issues/releases)
|
[](https://github.com/actions-cool/pr-extract-issues/releases)
|
||||||
|
|
||||||
|
A GitHub Action help you extract issues from pr commit or title or body.
|
||||||
|
|
||||||
## 🚀 How to use?
|
## 🚀 How to use?
|
||||||
|
|
||||||
### Preview
|
### Preview
|
||||||
@@ -23,7 +25,7 @@ jobs:
|
|||||||
extract:
|
extract:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions-cool/pr-extract-issues@v1.0.0
|
- uses: actions-cool/pr-extract-issues@v1.1.0
|
||||||
with:
|
with:
|
||||||
way: 'commit'
|
way: 'commit'
|
||||||
issues-labels: 'l1, l2'
|
issues-labels: 'l1, l2'
|
||||||
@@ -38,6 +40,7 @@ jobs:
|
|||||||
| -- | -- | -- | -- |
|
| -- | -- | -- | -- |
|
||||||
| token | GitHub token | string | ✖ |
|
| token | GitHub token | string | ✖ |
|
||||||
| way | The way to query issues. Options: `title` `body` `commit` | string | ✔ |
|
| way | The way to query issues. Options: `title` `body` `commit` | string | ✔ |
|
||||||
|
| filter-label | Further filter issues through label | string | ✖ |
|
||||||
| issues-labels | Extra labels on issues | string | ✖ |
|
| issues-labels | Extra labels on issues | string | ✖ |
|
||||||
| issues-comment | Extra comment on issues | string | ✖ |
|
| issues-comment | Extra comment on issues | string | ✖ |
|
||||||
| issues-close | Extra close issues | string | ✖ |
|
| issues-close | Extra close issues | string | ✖ |
|
||||||
@@ -52,6 +55,7 @@ jobs:
|
|||||||
- Like: https://github.com/actions-cool/pr-extract-issues/pull/4
|
- Like: https://github.com/actions-cool/pr-extract-issues/pull/4
|
||||||
- Branch whole line display with # start
|
- Branch whole line display with # start
|
||||||
- `commit`: Like `title`
|
- `commit`: Like `title`
|
||||||
|
- `filter-label`: Note that github default hooks. That is, `fix` `close` `resolve` directly followed by issue number will be closed after success merge
|
||||||
- `issues-labels`: Support multiple, need to be separated by comma
|
- `issues-labels`: Support multiple, need to be separated by comma
|
||||||
- `issues-comment`: `${number}` will be replaced with the current issue number
|
- `issues-comment`: `${number}` will be replaced with the current issue number
|
||||||
- `issues-close`: Whether close issue
|
- `issues-close`: Whether close issue
|
||||||
|
@@ -10,12 +10,14 @@ branding:
|
|||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
token:
|
token:
|
||||||
description: Secret GitHub API token to use for making API requests.
|
description: Secret GitHub API token to use for making API requests
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
required: true
|
required: true
|
||||||
way:
|
way:
|
||||||
description: The way to query issues.
|
description: The way to query issues
|
||||||
required: true
|
required: true
|
||||||
|
filter-label:
|
||||||
|
description: Further filter issues through label
|
||||||
issues-labels:
|
issues-labels:
|
||||||
description: Extra operations on issues
|
description: Extra operations on issues
|
||||||
issues-comment:
|
issues-comment:
|
||||||
@@ -25,7 +27,7 @@ inputs:
|
|||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
issues:
|
issues:
|
||||||
description: Get issues numbers.
|
description: Get issues numbers
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
|
35
dist/index.js
vendored
35
dist/index.js
vendored
File diff suppressed because one or more lines are too long
19
src/main.js
19
src/main.js
@@ -55,6 +55,25 @@ async function run() {
|
|||||||
core.setFailed('Wrong way!');
|
core.setFailed('Wrong way!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const filterLabel = core.getInput('filter-label');
|
||||||
|
if (filterLabel) {
|
||||||
|
let arr = [];
|
||||||
|
for await (let no of issues) {
|
||||||
|
const {
|
||||||
|
data: { labels },
|
||||||
|
} = await octokit.issues.get({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: no,
|
||||||
|
});
|
||||||
|
let o = labels.find(k => k.name == filterLabel);
|
||||||
|
if (o) {
|
||||||
|
arr.push(no);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
issues = [...arr];
|
||||||
|
}
|
||||||
|
|
||||||
core.info(`[Action: Query Issues][${issues}]`);
|
core.info(`[Action: Query Issues][${issues}]`);
|
||||||
core.setOutput('issues', issues);
|
core.setOutput('issues', issues);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user