Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
crosshair

GitHub Action

Find Last Issue

v1.1.0

Find Last Issue

crosshair

Find Last Issue

GitHub Action to find and export the number of last updated issue whithin some repository that has given labels

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Find Last Issue

uses: micalevisk/[email protected]

Learn more about this action in micalevisk/last-issue-action

Choose a version

Find Last Issue

GitHub Action to find and output the number of last updated issue that has given labels and state.

Action inputs

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:
  • "open": if you want to look up for open issues only
  • "closed": if you want to look up for closed issues only
  • "all": if you want to look up for open or closed ones
"open"

Action outputs

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.

Environment variables

Name Description Default
GITHUB_TOKEN GITHUB_TOKEN or a repo scoped Personal Access Token GITHUB_TOKEN secret created by GitHub

Example usage

You can use this action along with create-issue-from-file action, like:

# ...

- 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