How to simplify configuring JIRA Ticket links on GitHub

Viewed 44

In our github organization we have a lot of repositories. All of them shall convert JIRA tickets names in comments/PRs like XYZ-123 to links to the corresponding JIRA ticket. This is possible with Autolinking.

The downside of this approach ist, that Autolinking is supporting only Prefixes (no regex-es like GitLab). This results in one entry per JIRA projekt (i.e if I want to support ABC-123 and XYZ-123 two entries with the prefix ABC- and XYZ- are required).

What makes things worse is, that Autolinking has to be configured per repository. This means I have to add all Autolink entries to every Repository in our company (and maintain these lists).

Is there no simpler solution?

1 Answers

There does not seem to be any native simpler solution than the official Configuring autolinks to reference external resources.

You would need a GitHub Action to update a PR, replacing/making the JIRA links as you want them to be.

Example, with a .github/workflows/pr_update.yml:

name: PR update
on:
  pull_request:
    types: [opened]


jobs:
  update_pr:
  name: Update PR
    runs-on: ubuntu-latest
    steps:
      - uses: tzkhan/pr-update-action@v2
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
          base-branch-regex: '[A-Za-z\d-_.\\/]+'
          head-branch-regex: '^([A-Za-z])+-\d+'
          title-template: '%headbranch%: '
          body-template: |
            Jira issue: %headbranch%
            ---
          body-update-action: 'prefix'
          body-uppercase-base-match: false
Related