Create Repository Autolink

Action ID: github:autolinks:create
NPM Package:

@backstage/plugin-scaffolder-backend-module-github

Description

Create an autolink reference for a repository

Input Schema

PropertyTypeDescriptionRequired
tokenstringThe token to use for authorization to GitHub
repoUrlstringAccepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username
keyPrefixstringThis prefix appended by certain characters will generate a link any time it is found in an issue, pull request, or commit.
urlTemplatestringThe URL must contain `<num>` for the reference number. `<num>` matches different characters depending on the value of isAlphanumeric.
isAlphanumericbooleanWhether this autolink reference matches alphanumeric characters. If `true`, the `<num>` parameter of the `url_template` matches alphanumeric characters `A-Z` (case insensitive), `0-9`, and `-`. If `false`, this autolink reference only matches numeric characters. Default: `true`

Output Schema

No output schema defined for this action.

Usage Examples

Creates an autolink so references like SVC-123 link to the corresponding Jira issue. Run this after fetch:template and publish:github.

Copy
steps:
  - id: fetch-skeleton
    action: fetch:template
    input:
      url: ./skeleton
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

  - id: publish
    action: publish:github
    input:
      repoUrl: ${{ parameters.repoUrl }}

  - id: autolink-jira
    action: github:autolinks:create
    input:
      repoUrl: ${{ parameters.repoUrl }}
      keyPrefix: "SVC-"
      urlTemplate: "https://acme.atlassian.net/browse/SVC-<num>"
      isAlphanumeric: false

Creates an autolink so RFC-42 style references link to your internal RFC portal. Use this when you want lightweight cross linking of design docs after publish:github.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./skeleton
      values:
        name: ${{ parameters.name }}

  - id: publish
    action: publish:github
    input:
      repoUrl: ${{ parameters.repoUrl }}

  - id: autolink-rfc
    action: github:autolinks:create
    input:
      repoUrl: ${{ parameters.repoUrl }}
      keyPrefix: "RFC-"
      urlTemplate: "https://docs.acme.internal/rfcs/<num>"

Creates an autolink so AB#123 references open the corresponding Azure Boards work item. Provide a token when the default GitHub App credentials are not sufficient.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./skeleton
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

  - id: publish
    action: publish:github
    input:
      repoUrl: ${{ parameters.repoUrl }}

  - id: autolink-azure-boards
    action: github:autolinks:create
    input:
      repoUrl: ${{ parameters.repoUrl }}
      keyPrefix: "AB#"
      urlTemplate: "https://dev.azure.com/acme/engineering/_workitems/edit/<num>"
      isAlphanumeric: false
      token: ${{ parameters.githubToken }}

Creates two autolinks so SENTRY-100 and RUN-200 link to Sentry issues and internal runbooks. Use this to set up several patterns for the same repository in one workflow.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./skeleton
      values:
        name: ${{ parameters.name }}

  - id: publish
    action: publish:github
    input:
      repoUrl: ${{ parameters.repoUrl }}

  - id: autolink-sentry
    action: github:autolinks:create
    input:
      repoUrl: ${{ parameters.repoUrl }}
      keyPrefix: "SENTRY-"
      urlTemplate: "https://sentry.io/organizations/acme/issues/<num>"
      isAlphanumeric: false

  - id: autolink-runbooks
    action: github:autolinks:create
    input:
      repoUrl: ${{ parameters.repoUrl }}
      keyPrefix: "RUN-"
      urlTemplate: "https://runbooks.acme.internal/RUN-<num>"
      isAlphanumeric: false

Match alphanumeric design spec IDs

Creates an autolink for DESIGN-AB-123 references where the suffix can include letters, digits, and dashes. Explicitly enables alphanumeric matching for mixed ID formats.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./skeleton
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

  - id: publish
    action: publish:github
    input:
      repoUrl: ${{ parameters.repoUrl }}

  - id: autolink-design-specs
    action: github:autolinks:create
    input:
      repoUrl: ${{ parameters.repoUrl }}
      keyPrefix: "DESIGN-"
      urlTemplate: "https://design.acme.internal/specs/<num>"
      isAlphanumeric: true