Skip to content

Commit

Permalink
Jira Sync - use Composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
tomassebestik committed Sep 13, 2024
1 parent e759fc7 commit f0bba92
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/issue_comment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sync issue comments to JIRA
name: Sync issue comments to JIRA (legacy caller)

# This workflow will be triggered when new issue comment is created (including PR comments)
on: issue_comment
Expand All @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@master
- name: Sync issue comments to JIRA
# uses: espressif/sync-jira-actions@v1
uses: espressif/github-actions/sync_issues_to_jira@deprecate/jira-sync-action
uses: espressif/sync-jira-actions@change/composite-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_PASS: ${{ secrets.JIRA_PASS }}
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/issue_comment_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sync issue comments to JIRA (Docker; current v1)

# This workflow will be triggered when new issue comment is created (including PR comments)
on: issue_comment

jobs:
sync_issue_comments_to_jira:
name: Sync Issue Comments to Jira
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Sync issue comments to JIRA
uses: espressif/sync-jira-actions@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_PASS: ${{ secrets.JIRA_PASS }}
JIRA_PROJECT: IDFSYNTEST
JIRA_COMPONENT: GitHub
JIRA_URL: ${{ secrets.JIRA_URL }}
JIRA_USER: ${{ secrets.JIRA_USER }}
4 changes: 2 additions & 2 deletions .github/workflows/new_issues.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sync issues to Jira
name: Sync issues to Jira (legacy caller)

# This workflow will be triggered when a new issue is opened
on: issues
Expand All @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@master
- name: Sync GitHub issues to Jira project
# uses: espressif/sync-jira-actions@v1
uses: espressif/github-actions/sync_issues_to_jira@deprecate/jira-sync-action
uses: espressif/sync-jira-actions@change/composite-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_PASS: ${{ secrets.JIRA_PASS }}
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/new_issues_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sync issues to Jira (Docker; current v1)

# This workflow will be triggered when a new issue is opened
on: issues

jobs:
sync_issues_to_jira:
name: Sync issues to Jira
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Sync GitHub issues to Jira project
uses: espressif/sync-jira-actions@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_PASS: ${{ secrets.JIRA_PASS }}
JIRA_PROJECT: IDFSYNTEST
JIRA_COMPONENT: GitHub
JIRA_URL: ${{ secrets.JIRA_URL }}
JIRA_USER: ${{ secrets.JIRA_USER }}
24 changes: 24 additions & 0 deletions .github/workflows/new_prs-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Sync remain PRs to Jira (Docker; current v1)
# This workflow will be triggered every hour, to sync remaining PRs (i.e. PRs with zero comment) to Jira project
# Note that, PRs can also get synced when new PR comment is created
on:
schedule:
- cron: "0 * * * *"

jobs:
sync_prs_to_jira:
name: Sync PRs to Jira
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Sync PRs to Jira project
uses: espressif/sync-jira-actions@v1
with:
cron_job: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_PASS: ${{ secrets.JIRA_PASS }}
JIRA_PROJECT: IDFSYNTEST
JIRA_COMPONENT: GitHub
JIRA_URL: ${{ secrets.JIRA_URL }}
JIRA_USER: ${{ secrets.JIRA_USER }}
6 changes: 3 additions & 3 deletions .github/workflows/new_prs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Sync remain PRs to Jira
name: Sync remain PRs to Jira (legacy caller)

# This workflow will be triggered every hour, to sync remaining PRs (i.e. PRs with zero comment) to Jira project
# Note that, PRs can also get synced when new PR comment is created
on:
schedule:
- cron: "0/5 * * * *"
- cron: "0 * * * *"

jobs:
sync_prs_to_jira:
Expand All @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@master
- name: Sync PRs to Jira project
# uses: espressif/sync-jira-actions@v1
uses: espressif/github-actions/sync_issues_to_jira@deprecate/jira-sync-action
uses: espressif/sync-jira-actions@change/composite-action
with:
cron_job: true
env:
Expand Down
39 changes: 22 additions & 17 deletions .github/workflows/sync-jira.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
---
name: Sync to Jira (combined)
# This GitHub Actions workflow synchronizes GitHub issues, comments, and pull requests with Jira.
# It triggers on new issues, issue comments, and on a scheduled basis.
# The workflow uses a custom action to perform the synchronization with Jira (espressif/sync-jira-actions).

name: Sync to Jira
run-name: >
Sync to Jira -
${{ github.event_name == 'issue_comment' && 'Issue Comments' ||
github.event_name == 'schedule' && 'New Pull Requests' ||
github.event_name == 'issues' && 'New Issues' }}
on:
issues: { types: [opened] }
issue_comment: { types: [created, edited, deleted] }
schedule: [{ cron: '0 * * * *' }]
schedule: [cron: '0 * * * *']

jobs:
sync_to_jira:
sync-to-jira:
name: >
Sync to Jira -
${{ github.event_name == 'issue_comment' && 'Issue Comments' ||
github.event_name == 'schedule' && 'New Pull Requests' ||
Sync to Jira -
${{ github.event_name == 'issue_comment' && 'Issue Comments' ||
github.event_name == 'schedule' && 'New Pull Requests' ||
github.event_name == 'issues' && 'New Issues' }}
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: Check out PR head
uses: actions/checkout@v4

- name: Debug Event Name
run: |
echo "Event Name: ${{ github.event_name }}"
- name: Sync to Jira
uses: espressif/sync-jira-actions@v1
# with:
# cron_job: ${{ github.event_name == 'schedule' && 'true' || 'false' }}
uses: espressif/sync-jira-actions@change/v1
with:
jira-project: IDFSYNTEST
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_PASS: ${{ secrets.JIRA_PASS }}
JIRA_URL: ${{ secrets.JIRA_URL }}
JIRA_USER: ${{ secrets.JIRA_USER }}
JIRA_PROJECT: IDFSYNTEST
JIRA_COMPONENT: GitHub
JIRA_ISSUE_TYPE: Task
INPUT_CRON_JOB: ${{ github.event_name == 'schedule' && 'true' || '' }} # this is kind of a hack; code of the action needs to be modified

0 comments on commit f0bba92

Please sign in to comment.