Skip to content

Component - Search - Accessibility #60

Component - Search - Accessibility

Component - Search - Accessibility #60

name: Post issue comment to Jira
on:
issue_comment:
types: [created]
jobs:
issue_commented:
if: ${{ !github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- name: Create comment body file
run: echo "${{ github.event.comment.body }}" > ${{ runner.temp }}/_github_workflow/comment.md
- name: Convert GitHub markdown to Jira markup
uses: docker://pandoc/core:3.1
with:
args: --from gfm --to jira --output=/github/workflow/comment.jira /github/workflow/comment.md
- name: Put output to the variable
run: |
echo 'JIRA_CONTENT<<EOF' >> $GITHUB_ENV
cat ${{ runner.temp }}/_github_workflow/comment.jira >> $GITHUB_ENV
echo >> $GITHUB_ENV
echo "----" >> $GITHUB_ENV
echo "GitHub comment: ${{ github.event.comment.html_url }}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Login
uses: atlassian/gajira-login@v3
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: Find JIRA ticket in the issue body
id: find_key
run: |
jira_id="$(echo "${{ github.event.issue.body }}" | grep -o -E '${{ vars.JIRA_PROJECT_KEY }}\-[0-9]+')" || true
echo "jira_id=$jira_id" >> $GITHUB_OUTPUT
- name: Comment on Jira issue
uses: atlassian/gajira-comment@v3
if: ${{ startsWith(steps.find_key.outputs.jira_id, format('{0}-', vars.JIRA_PROJECT_KEY)) }}
with:
issue: ${{ steps.find_key.outputs.jira_id }}
comment: ${{ env.JIRA_CONTENT }}