|
| 1 | +name: SmartBear Supported Issue Comment Created |
| 2 | + |
| 3 | +# Example of trigger for this workflow: |
| 4 | +# |
| 5 | +# on: |
| 6 | +# issue_comment: |
| 7 | +# types: |
| 8 | +# - created |
| 9 | + |
| 10 | +on: |
| 11 | + workflow_call: |
| 12 | + |
| 13 | +jobs: |
| 14 | + jira: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + if: ${{ github.event.comment.body == '/smartbear-supported issue' }} |
| 17 | + steps: |
| 18 | + - run: echo ${{ github.event.comment.body }} |
| 19 | + |
| 20 | + - name: Login |
| 21 | + uses: atlassian/gajira-login@ca13f8850ea309cf44a6e4e0c49d9aa48ac3ca4c # v3 |
| 22 | + env: |
| 23 | + JIRA_BASE_URL: ${{ secrets.SMARTBEAR_JIRA_BASE_URL }} |
| 24 | + JIRA_USER_EMAIL: ${{ secrets.SMARTBEAR_JIRA_USER_EMAIL }} |
| 25 | + JIRA_API_TOKEN: ${{ secrets.SMARTBEAR_JIRA_API_TOKEN }} |
| 26 | + ISSUE_TITLE: ${{ github.event.issue.title }} |
| 27 | + |
| 28 | + - name: Search |
| 29 | + id: search |
| 30 | + uses: tomhjp/gh-action-jira-search@04700b457f317c3e341ce90da5a3ff4ce058f2fa # v0.2.2 |
| 31 | + with: |
| 32 | + jql: 'summary ~ "${{ github.event.repository.name }}#${{ github.event.issue.number }}:" AND project=${{ vars.SMARTBEAR_JIRA_PROJECT }}' |
| 33 | + |
| 34 | + - name: Log |
| 35 | + run: echo "Found issue ${{ steps.search.outputs.issue }}" |
| 36 | + |
| 37 | + - name: Create |
| 38 | + id: create |
| 39 | + if: steps.search.outputs.issue == '' |
| 40 | + uses: atlassian/gajira-create@1ff0b6bd115a780592b47bfbb63fc4629132e6ec # v3 |
| 41 | + with: |
| 42 | + project: ${{ secrets.SMARTBEAR_JIRA_PROJECT }} |
| 43 | + issuetype: Task |
| 44 | + summary: '${{ github.event.repository.name }}#${{ github.event.issue.number }}: ${{ github.event.issue.title }}' |
| 45 | + description: | |
| 46 | + *Issue Link:* ${{ github.event.issue.html_url }} |
| 47 | + |
| 48 | + ${{ github.event.issue.body }} |
| 49 | + fields: '{"customfield_10006": ${{ toJSON(secrets.SMARTBEAR_JIRA_EPIC_TICKET) }}, "customfield_17401":{"value":${{ toJSON( secrets.SMARTBEAR_JIRA_LAYER_CAKE )}}}}' |
| 50 | + |
| 51 | + - name: Add Comment |
| 52 | + if: steps.search.outputs.issue == '' && steps.create.outputs.issue != '' |
| 53 | + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 |
| 54 | + with: |
| 55 | + github-token: ${{secrets.GITHUB_TOKEN}} |
| 56 | + script: | |
| 57 | + github.rest.issues.createComment({ |
| 58 | + issue_number: context.issue.number, |
| 59 | + owner: context.repo.owner, |
| 60 | + repo: context.repo.repo, |
| 61 | + body: "👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (${{steps.create.outputs.issue}}). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps. <br/><br/>See our <a href='https://docs.pact.io/help/smartbear'>documentation</a> for more information." |
| 62 | + }) |
| 63 | +
|
| 64 | + - name: Add Jira Label |
| 65 | + uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1 |
| 66 | + if: steps.search.outputs.issue == '' && steps.create.outputs.issue != '' |
| 67 | + with: |
| 68 | + labels: smartbear-supported |
0 commit comments