Coder Social home page Coder Social logo

osowskit / jira-link-updater Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 3.0 37 KB

GitHub App that replaces JIRA IDs in Issue comments with a URL to the JIRA issue

Home Page: https://github.com/apps/jira-link-updater

Ruby 100.00%
github-app jira github-enterprise

jira-link-updater's Introduction

Overview

Ever add a JIRA ticket id to an Issue or Pull Request and wish it would link directly to the ticket. This GitHub App replaces JIRA IDs in comments with a URL to the JIRA issue. ๐ŸŽ‰

End User Instructions

Instructions to configure GitHub.com repositories.

  1. Visit jira-link-updater app and grant it access to your repositories.
  2. Add a configuration file to each repository to set a path to your JIRA instance.
    • Filename: JIRA_SETTINGS.yaml
    • Example:
    jira_hostname: "https://[SERVERNAME].atlassian.net"
    
  3. New Pull Requests and Issue comments with the format [XYZ-123] will be replaced with a hyperlink to the JIRA issue.

GitHub Enterprise Instructions

  1. Set up a new GitHub App on your GitHub Enterprise +2.12 instance.
    • Issues permissions - Read and Write
    • Pull requests permissions - Read and Write
    • Subscribe to events
      • Issues
      • Pull request event subscription
      • Issue Comments
  2. Host this application on a network that allows traffic to/from the GitHub Enterprise instance. ruby server.rb
  3. Install the App and grant it access to your repositories.
  4. Add comments to Issues and Pull Requests in the format [XYZ-123] to be replaced with a hyperlink

jira-link-updater's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jira-link-updater's Issues

Handle Webhooks at Scale

Problem

Very active repositories may eventually time out with serial processing of webhooks. GitHub may also be temporarily unavailable so handle retrying.

Discussion

  • Store webhook events and process them separately.
  • Gracefully fail when GitHub's API is unavailable
  • Cache the jira URL instead of loading it each webhook

Allow comment edits to trigger link replacement

The source currently ignores issue_comment : updated events to naively avoid processing this integration updating a comment

# Ignore Updated or Deleted comments
if webhook_action == "opened"

The webhook payload will contain returns a sender:type:Bot that can be checked to ignore an update by this integration. However, for a user update - this may not prevent the app attempting to nest the link.

Gracefully handle both .com and Enterprise

This app was written to assume GitHub Enterprise instance with a single JIRA url. This limits installations for both companies with multiple JIRA instances and .com users.

  • Handle API calls for both GHE and .com
  • #7 load JIRA hostname per repository
  • Consider queuing webhook events and processing them later

Handle matches in Issue `body`

Handle pull_request created event and replace matches in body

Consider replacing ID in the title hyperlinks in title don't show up so can be ignored

Load JIRA hostname from repository file

Problem

Loading the JIRA_HOSTNAME from an environment variable ties a single running app to one url. This limits allowing multiple JIRA instances - either on an internal network or for supporting github.com.

Requirements

  • Define YAML file that needs to exist in each repository
  • Modify App permissions to read a single file
  • Modify App to read and use this information
  • Determine how to cache JIRA URLs
    • Reading this file for each webhook can have serious performance implications

Handle missing JIRA URL

Problem

#7 requires that the JIRA fqdn is stored in a YAML file.

Discussion

It is possible to create an issue in each repository that can't load a JIRA URL stating jira-link-updater GitHub App requires the YAML file, displays a warning if the YAML is malformed, and possibly creates the YAML file as a template.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.