-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed71587
commit 3d2aed6
Showing
3 changed files
with
113 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,57 @@ | ||
# Find Last Issue | ||
|
||
GitHub Action to find and export the number of last updated issue that has given labels. | ||
GitHub Action to find and output the number of last updated issue that has given labels and state. | ||
|
||
### Inputs | ||
### Action inputs | ||
|
||
#### `labels` | ||
| Name | Description | Default | | ||
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | ||
| **\*** `labels` | Comma or newline-separated list of labels that the issue must have | | ||
| `state` | Issue state. Can be one of the following strings: <ul><li> <code>"open"</code>: if you want to look up for open issues only </li><li> <code>"closed"</code>: if you want to look up for closed issues only </li><li> <code>"all"</code>: if you want to look up for open or closed ones </li></ul> | `"open"` | | ||
|
||
> required | ||
### Action outputs | ||
|
||
Comma-separated label names that the issue must have. | ||
| Name | Description | | ||
| -------------- | --------------------------------------------------------------------------- | | ||
| `issue_number` | The number of the issue found, if any. | | ||
| `has_found` | Response status. Will be `true` if some issue was found. `false` otherwise. | | ||
|
||
### Outputs | ||
### Environment variables | ||
|
||
#### `issue_number` | ||
|
||
The number of the issue found, if any. | ||
|
||
#### `has_found` | ||
|
||
Response status. Will be `true` if some issue was found. `false` otherwise. | ||
| Name | Description | Default | | ||
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | | ||
| `GITHUB_TOKEN` | `GITHUB_TOKEN` or a `repo` scoped [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) | `GITHUB_TOKEN` secret created by GitHub | | ||
|
||
## Example usage | ||
|
||
```yaml | ||
uses: micalevisk/find-last-issue | ||
with: | ||
labels: 'report,automated issue' | ||
env: | ||
## Optional since it uses the `GITHUB_TOKEN` by default | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
For third-party repositories, you can use the `GITHUB_REPOSITORY` environment variable: | ||
You can use this action along with [create-issue-from-file](https://github.com/peter-evans/create-issue-from-file) action, like: | ||
|
||
```yaml | ||
env: | ||
GITHUB_REPOSITORY: owner/repo_name | ||
# ... | ||
|
||
- name: Find the last open report issue | ||
id: last_issue | ||
uses: micalevisk/find-last-issue@v1 | ||
with: | ||
state: open | ||
## The issue must have the following labels | ||
labels: | | ||
report | ||
automated issue | ||
env: | ||
## Optional since it uses the `GITHUB_TOKEN` created by GitHub by default | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: echo ${{ steps.last_issue.outputs.issue_number }} | ||
|
||
- name: Update last updated report issue | ||
if: ${{ steps.last_issue.outputs.has_found == 'true' }} | ||
uses: peter-evans/create-issue-from-file@v3 | ||
with: | ||
title: Foo | ||
content-filepath: README.md | ||
issue-number: ${{ steps.last_issue.outputs.issue_number }} | ||
labels: | | ||
report | ||
automated issue | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.