mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-07 15:16:56 +00:00
Update Jira workflow (#456)
* Migrate jira sync to common workflow --------- Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
This commit is contained in:
parent
d27529ebde
commit
2d9c2b9f1b
1 changed files with 8 additions and 63 deletions
71
.github/workflows/jira.yaml
vendored
71
.github/workflows/jira.yaml
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
|
name: JIRA Sync
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [opened, closed, deleted, reopened]
|
types: [opened, closed, deleted, reopened]
|
||||||
|
|
@ -5,68 +6,12 @@ on:
|
||||||
types: [opened, closed, reopened]
|
types: [opened, closed, reopened]
|
||||||
issue_comment: # Also triggers when commenting on a PR from the conversation view
|
issue_comment: # Also triggers when commenting on a PR from the conversation view
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
name: Jira Sync
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync:
|
sync:
|
||||||
runs-on: ubuntu-latest
|
uses: hashicorp/vault-workflows-common/.github/workflows/jira.yaml@main
|
||||||
name: Jira sync
|
secrets:
|
||||||
steps:
|
JIRA_SYNC_BASE_URL: ${{ secrets.JIRA_SYNC_BASE_URL }}
|
||||||
- name: Login
|
JIRA_SYNC_USER_EMAIL: ${{ secrets.JIRA_SYNC_USER_EMAIL }}
|
||||||
uses: atlassian/gajira-login@45fd029b9f1d6d8926c6f04175aa80c0e42c9026 # v3.0.1
|
JIRA_SYNC_API_TOKEN: ${{ secrets.JIRA_SYNC_API_TOKEN }}
|
||||||
env:
|
with:
|
||||||
JIRA_BASE_URL: ${{ secrets.JIRA_SYNC_BASE_URL }}
|
teams-array: '["applications-eco"]'
|
||||||
JIRA_USER_EMAIL: ${{ secrets.JIRA_SYNC_USER_EMAIL }}
|
|
||||||
JIRA_API_TOKEN: ${{ secrets.JIRA_SYNC_API_TOKEN }}
|
|
||||||
|
|
||||||
- name: Preprocess
|
|
||||||
if: github.event.action == 'opened' || github.event.action == 'created'
|
|
||||||
id: preprocess
|
|
||||||
run: |
|
|
||||||
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
|
|
||||||
echo "::set-output name=type::PR"
|
|
||||||
else
|
|
||||||
echo "::set-output name=type::ISS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create ticket
|
|
||||||
if: github.event.action == 'opened'
|
|
||||||
uses: tomhjp/gh-action-jira-create@3ed1789cad3521292e591a7cfa703215ec1348bf # v0.2.1
|
|
||||||
with:
|
|
||||||
project: VAULT
|
|
||||||
issuetype: "GH Issue"
|
|
||||||
summary: "${{ github.event.repository.name }} [${{ steps.preprocess.outputs.type }} #${{ github.event.issue.number || github.event.pull_request.number }}]: ${{ github.event.issue.title || github.event.pull_request.title }}"
|
|
||||||
description: "${{ github.event.issue.body || github.event.pull_request.body }}\n\n_Created from GitHub Action for ${{ github.event.issue.html_url || github.event.pull_request.html_url }} from ${{ github.actor }}_"
|
|
||||||
# customfield_10089 is Issue Link custom field
|
|
||||||
# customfield_10091 is team custom field
|
|
||||||
extraFields: '{"fixVersions": [{"name": "TBD"}], "customfield_10091": ["ecosystem", "applications"], "customfield_10089": "${{ github.event.issue.html_url || github.event.pull_request.html_url }}"}'
|
|
||||||
|
|
||||||
- name: Search
|
|
||||||
if: github.event.action != 'opened'
|
|
||||||
id: search
|
|
||||||
uses: tomhjp/gh-action-jira-search@04700b457f317c3e341ce90da5a3ff4ce058f2fa # v0.2.2
|
|
||||||
with:
|
|
||||||
# cf[10089] is Issue Link custom field
|
|
||||||
jql: 'project = "VAULT" and cf[10089]="${{ github.event.issue.html_url || github.event.pull_request.html_url }}"'
|
|
||||||
|
|
||||||
- name: Sync comment
|
|
||||||
if: github.event.action == 'created' && steps.search.outputs.issue
|
|
||||||
uses: tomhjp/gh-action-jira-comment@6eb6b9ead70221916b6badd118c24535ed220bd9 # v0.2.0
|
|
||||||
with:
|
|
||||||
issue: ${{ steps.search.outputs.issue }}
|
|
||||||
comment: "${{ github.actor }} ${{ github.event.review.state || 'commented' }}:\n\n${{ github.event.comment.body || github.event.review.body }}\n\n${{ github.event.comment.html_url || github.event.review.html_url }}"
|
|
||||||
|
|
||||||
- name: Close ticket
|
|
||||||
if: (github.event.action == 'closed' || github.event.action == 'deleted') && steps.search.outputs.issue
|
|
||||||
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3
|
|
||||||
with:
|
|
||||||
issue: ${{ steps.search.outputs.issue }}
|
|
||||||
transition: Closed
|
|
||||||
|
|
||||||
- name: Reopen ticket
|
|
||||||
if: github.event.action == 'reopened' && steps.search.outputs.issue
|
|
||||||
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3
|
|
||||||
with:
|
|
||||||
issue: ${{ steps.search.outputs.issue }}
|
|
||||||
transition: "Pending Triage"
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue