jira-sync.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. on:
  2. issues:
  3. types: [closed, deleted, reopened]
  4. pull_request_target:
  5. types: [closed, reopened]
  6. name: Jira Sync
  7. jobs:
  8. sync:
  9. runs-on: ubuntu-latest
  10. name: Jira sync
  11. steps:
  12. - name: Login
  13. uses: atlassian/gajira-login@45fd029b9f1d6d8926c6f04175aa80c0e42c9026 # v3.0.1
  14. if: contains(github.event.pull_request.labels.*.name, 'tf-devex-triage') || contains(github.event.issue.labels.*.name, 'tf-devex-triage')
  15. env:
  16. JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
  17. JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
  18. JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
  19. - name: Search for existing issue
  20. id: search
  21. if: contains(github.event.pull_request.labels.*.name, 'tf-devex-triage') || contains(github.event.issue.labels.*.name, 'tf-devex-triage')
  22. uses: tomhjp/gh-action-jira-search@04700b457f317c3e341ce90da5a3ff4ce058f2fa # v0.2.2
  23. with:
  24. jql: 'project="TFECO" and "Team (R&D)[Labels]"="TF-DevEx" and description ~ "${{ github.event.issue.html_url || github.event.pull_request.html_url }}" and labels in (Github)'
  25. - name: Close task
  26. if: ( github.event.action == 'closed' || github.event.action == 'deleted' ) && steps.search.outputs.issue
  27. uses: atlassian/gajira-transition@38fc9cd61b03d6a53dd35fcccda172fe04b36de3 # v3.0.1
  28. with:
  29. issue: ${{ steps.search.outputs.issue }}
  30. transition: "Closed"
  31. - name: Reopen task
  32. if: github.event.action == 'reopened' && steps.search.outputs.issue
  33. uses: atlassian/gajira-transition@38fc9cd61b03d6a53dd35fcccda172fe04b36de3 # v3.0.1
  34. with:
  35. issue: ${{ steps.search.outputs.issue }}
  36. transition: "To Do"