Pull Request Description | Jira Ticket |
---|---|
- 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
jiraId: ${{steps.extract_branch_name.outputs.jira_id}} # required
orgUrl: https://testcompany.atlassian.net # required
jiraToken: ${{secrets.JIRA_API_TOKEN}} # required
jiraUsername: ${{secrets.JIRA_USERNAME}} # required
sonarQubeUrl: https://sonar.testcompany.co # optional
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 API token can be obtained from the account settings in Jira , reference .
- Jira API token should be added to repository secrets with the desired name for the token value .
- 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.