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

GitHub Action

Get Linked Issues

v1.0

Get Linked Issues

link

Get Linked Issues

Find the issues linked to a given pull request

Installation

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

              

- name: Get Linked Issues

uses: kin/[email protected]

Learn more about this action in kin/gh-action-get-linked-issues

Choose a version

Get Linked Issues

A utility that takes a PR and returns the issue object(s) returned by GH API that the PR is linked to. Github linking syntax.

Workflow Template

This is desinged to be used with other actions that process the returned issues. Below is an example workflow YML that moves the project cards for issues linked to the PR into the 'Ready for Review' column when the PR is opened for review.

name: Sync Review Status

on:
  # Requires the event trigger to be of type pull_request or pull_request_target
  pull_request_target:
    types: [review_requested]

jobs:
  sync-review-status:
    runs-on: ubuntu-latest
    name: Get Linked Issues
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Get Linked Issues Action
        uses: kin/[email protected]
        id: linked-issues
        with:
          # Required: personal access token with permissions to archive cards
		  access-token: "${{ secrets.GITHUB_TOKEN }}"

	  - name: Move Issues to Ready for Review Column
	    uses: kin/[email protected]
		with:
		  access-token: "${{ secrets.GITHUB_TOKEN }}"
		  target-column: "Ready for Review"
		  issues: ${{ steps.linked-issues.outputs.issues }}

Inputs

  • access-token: Access token for repository. Use "{{ secrets.GITHUB_TOKEN }}" to prevent leaking secrets.
  • It is important to note that this action requires that the workflow trigger event is of the pull_request or pull_request_target type.

Outputs

  • issues: A stringified array of issue payloads with each issue payload formatted as { issue: { <payload> } }

Known Issues

This will not find issues that are linked through the UI, nor will it find issues linked in repos outside of the one the PR is in. There is a planned fix for both of these issues.

Contribution

To cotnribute, please open an Issue on the action repo: https://github.com/kin/gh-action-autoarchive-issues-for-column to discuss bugs/modifications.