Skip to content

Github action to integrate Jira ticket Info to Pull request description whenever a pull request event occurs

License

Notifications You must be signed in to change notification settings

sylwek845/Jira-PR-Info

 
 

Repository files navigation

@ks-keshava-rao/Jira-description

Github action to integrate your Jira ticket description to the associated pull request description.

Pull Request Description Jira Ticket
PR-description Jira Ticket

Example Workflow

  • Create a file jira-pr-action.yml in the .github/workflows directory in your repository with the following content:
name: Update PR Description from Jira 
on:
 pull_request:
   types: [opened , reopened]

jobs:
 update_pr_description:
   runs-on: ubuntu-latest

   steps:
     - name: Checkout repository
       uses: actions/checkout@v2

     - name: Update PR description 
       id: update_description
       uses: ks-keshava-rao/Jira-description@v1
       with:
          token: ${{secrets.GITHUB_TOKEN}} # required
          orgUrl: https://testcompany.atlassian.net # required
          jiraToken: ${{secrets.JIRA_API_TOKEN}} # required
          jiraUsername: ${{secrets.JIRA_USERNAME}} # required
          sonarQubeUrl: https://sonar.testcompany.co # optional

Inputs

Name Description Example Required
token Automatically generated repo scoped token, provided by Github by default. configure read and write permissions for the workflow. ${{ secrets.GITHUB_TOKEN }} Yes
jiraId Jira issue id or Jira ticket id for the associated jira issue, can be extracted from a step in a job or obtained by any other way . ${{steps.extract_branch_name.outputs.jira_id}} or SWT-328 Yes
orgUrl Organisation's sub-domain for Jira . https://sub-domain.atlassian.net Yes
jiraToken Project scoped Jira API token for Authorization. check here for configuring the Jira API token into your Repo ${{secrets.JIRA_API_TOKEN}} Yes
jiraUsername Email address or username of the user account in Jira from which the jiraToken was obtained refer . ${{secrets.JIRA_USERNAME}} Yes
sonarQubeUrl Organization's sonarQube sub-domain for code quality and analysis if applicable . https://sonar.testcompany.co No

Warning

Action result - the action will fail the workflow in case required input fields provided are incorrect or invalid .

jira-authorization-credentials

  1. Jira API token can be obtained from the account settings in Jira , reference .
  2. Jira API token should be added to repository secrets with the desired name for the token value .
  3. The Jira username must correspond to the email address of the user account used to generate the Jira API token. This username should be set as a secret key in the repository's secrets under the chosen name for the username value.

Note

This build makes use of Jira REST API V2, which means that the Markdown formatting in Jira and GitHub pull requests may not perfectly align. While certain advanced formatting features may not translate precisely, basic elements like plain text, bullet points, and paragraphs remain consistent between the two platforms.

[!Contribution] Please raise a Pull Request to contribute. Remember to run ncc build src/index.js -> More info https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action

About

Github action to integrate Jira ticket Info to Pull request description whenever a pull request event occurs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%