Skip to content

GEOPY-1226: OMF files failing to export and import from command line #37

GEOPY-1226: OMF files failing to export and import from command line

GEOPY-1226: OMF files failing to export and import from command line #37

# This workflow will comment the PR with the JIRA issue summary
# if a JIRA issue number is detected in the branch name or title
name: Add JIRA issue summary
on:
pull_request_target:
types: [opened]
jobs:
add_jira_summary:
runs-on: ubuntu-latest
steps:
- name: Find JIRA issue key
id: find_jira_key
env:
HEAD_REF: ${{ github.head_ref}}
PR_TITLE: ${{ github.event.pull_request.title }}
run: >
echo $HEAD_REF $PR_TITLE
| echo "issue_key=$(grep -os "\b\(GA\|GEOPY\)-[0-9]\+" | head -n1)" >> $GITHUB_OUTPUT
- name: Get JIRA summary
id: get_jira_summary
if: ${{ steps.find_jira_key.outputs.issue_key }}
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_BASIC_AUTH: ${{ secrets.JIRA_BASIC_AUTH }}
run: >
curl -sS -X GET
-H "Authorization: Basic $JIRA_BASIC_AUTH"
-H "Content-Type: application/json"
"$JIRA_BASE_URL/rest/api/2/issue/${{ steps.find_jira_key.outputs.issue_key }}"
| echo "summary=$(jq -r '.fields.summary')" >> $GITHUB_OUTPUT
- name: Add comment
if: ${{ steps.find_jira_key.outputs.issue_key }}
env:
ISSUE_SUMMARY: ${{ steps.get_jira_summary.outputs.summary }}
PR_BODY: ${{ github.event.pull_request.body }}
run: >
jq
--arg ISSUE_ID "${{ steps.find_jira_key.outputs.issue_key }}"
--arg ISSUE_SUMMARY "$(cat <<< $ISSUE_SUMMARY)"
--arg PR_BODY "$(cat <<< $PR_BODY)"
-c '."body"="**" + $ISSUE_ID + " - " + $ISSUE_SUMMARY + "**\n" + $PR_BODY' <<< {}
| curl -sS -X POST -d @-
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}"
-H "Content-Type: application/json"
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/${{ github.event.pull_request.number }}"
> /dev/null