4 Commits

Author SHA1 Message Date
xrkffgg
78a8afb859 feat: add filterLabel (#19)
* feat: add filterLabel

* add changelog
2021-03-17 15:10:57 +08:00
xrkffgg
dd11fb5133 Update extract-issues.yml 2021-03-17 14:57:49 +08:00
xrkffgg
ae5b70b9f0 Update README.md 2021-03-12 10:22:02 +08:00
xrkffgg
ec59498db2 Update CHANGELOG.md 2021-03-12 10:17:49 +08:00
6 changed files with 71 additions and 8 deletions

View File

@@ -8,10 +8,11 @@ jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions-cool/pr-extract-issues@main
- uses: actions-cool/pr-extract-issues@t
with:
way: 'commit'
issues-labels: 'l1, l2'
filter-label: 'bug'
issues-comment: |
HI。这个 issue: ${number} 已经被修复了。
issues-close: true

View File

@@ -1,7 +1,13 @@
# 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
`2021.xx.xx`
`2021.03.12`
- 🎉 Init.

View File

@@ -4,6 +4,8 @@
[![](https://img.shields.io/badge/marketplace-pr--extract--issues-blueviolet?style=flat-square)](https://github.com/marketplace/actions/pr-extract-issues)
[![](https://img.shields.io/github/v/release/actions-cool/pr-extract-issues?style=flat-square&color=orange)](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?
### Preview
@@ -23,7 +25,7 @@ jobs:
extract:
runs-on: ubuntu-latest
steps:
- uses: actions-cool/pr-extract-issues@v1.0.0
- uses: actions-cool/pr-extract-issues@v1.1.0
with:
way: 'commit'
issues-labels: 'l1, l2'
@@ -38,6 +40,7 @@ jobs:
| -- | -- | -- | -- |
| token | GitHub token | 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-comment | Extra comment on issues | string | ✖ |
| issues-close | Extra close issues | string | ✖ |
@@ -52,6 +55,7 @@ jobs:
- Like: https://github.com/actions-cool/pr-extract-issues/pull/4
- Branch whole line display with # start
- `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-comment`: `${number}` will be replaced with the current issue number
- `issues-close`: Whether close issue

View File

@@ -10,12 +10,14 @@ branding:
inputs:
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 }}
required: true
way:
description: The way to query issues.
description: The way to query issues
required: true
filter-label:
description: Further filter issues through label
issues-labels:
description: Extra operations on issues
issues-comment:
@@ -25,7 +27,7 @@ inputs:
outputs:
issues:
description: Get issues numbers.
description: Get issues numbers
runs:
using: 'node12'

35
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -55,6 +55,25 @@ async function run() {
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.setOutput('issues', issues);