How to call GitHub action with GitHub App token or Oauth token from Jira web request

baban kumar June 13, 2024

Hi All,

We have a scenario where we have to trigger GitHUb Action from  Jira Automation workflow and we are able to successfully trigger with GitHub Personal Access Token ( PAT). 

But we do not want to use PAT and want to trigger GitHub action either  with GitHub App id or GitHub Oauth  from Jira Server .

Any idea  how can we do this ?

1 answer

0 votes
Gaurav Yadav June 26, 2024

+1 having same requirement, struggling from few weeks for getting it done.

@baban kumar did you get anything?

@ssamuels FYI

Gaurav Yadav June 26, 2024

@Srikanth Bheemunipallywar Thanks for sharing it, all the steps described already achieved, as asked in the question we don't want to use PAT while sending request from JIRA. Looking for option how to extract github app token within JIRA

baban kumar July 8, 2024

Hi All,

As  my best knowledge , i think there are 2 solutions to do this :-

Solution 1:-

Install the App "Jira Integration for GitHub from GitHub Marketplace

Jira Integration for Github · GitHub Marketplace

  1. Go to the GitHub App Marketplace and search for "Jira Integration".
  2. Click on the "Install" button.
  3. Follow the instructions to authorize the app to access your GitHub repository and Jira project.
  4. Once the app is authorized, you will see a new "Jira" tab in your GitHub repository.
  5. In the "Jira" tab, you can see a list of your Jira projects.
  6. Click on the name of the Jira project that you want to connect to.
  7. In the "Settings" section, you can configure the connection between GitHub and Jira.
  8. Once you have configured the connection, you can start triggering GitHub workflows from Jira issues.

 

Solution 2:

Check in Jira with Admin access if you have ScriptRunner tool present . 

Introduction to ScriptRunner (adaptavist.com)

 

ScriptRunner supports Groovy language . So, in Groovy you have to write  a  code with below functions:-

Function to generate JWT token with input as GitHub App  ID and private  key file. Then with this JWT and GitHub App install ID , generate a random Auth token which will be used  as AUthorization  Bearer  "$githubrandomtoken  to trigger GitHub action. 

 

Suggest an answer

Log in or Sign up to answer