Sync Github issue to Jira via GitHub Actions (GHA)
Tags: githubhack23, githubactions, jira
Published: 2023-05-07 13:12:31

## What I built
I built action to help the OSS maintainer easily manage certain issues on Jira.

I assume most of the OSS project has a similar process to accept the issue. For instance, if the user creates a new issue then the core maintainer will check the new issue including the content, format, etc.. if the new issue is appropriate the maintainer adds a label as showing accepted.

I found the problem during this process. 
Most OSS maintainers want to manage certain issues such as critical bugs using ticketing software such as Jira however  managing certain issues on Jira can be a time-consuming task. Especially when the OSS is used by many developers. Because a lot of issues can be created by users.

So I create the action to sync the Github issue to Jira automatically when the maintainer is labeled to issue as accepted.

### Category Submission:
Maintainer Must-Haves

### App Link
https://github.com/marketplace/actions/github-issue-sync-2-jira

### Screenshots 

![github-actions-market](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s6k32hkecp2f6lskimuj.png)

### Description
This action helps to sync github issue to Jira automatically:
- An example of using a this action is when a label is applied to a GitHub issue, triggering the action to automatically synchronize the issue with Jira.

- A custom label can be utilized as a sync/skipping.

#### Feature
- Sync Github issue to Jira
- A custom acceptance label can be utilized as a synchronization target.
- A custom synced label can be utilized as a synchronization/skipping.
- By applying a custom Jira issue type to a Jira ticket, it can be utilized.

The action will first check if the labeled issue exists, then fetch the attached labels to check if the issue is already accepted by the organizer or checked already synced to Jira.
If the already attached synced label, the action will skip the whole process. Otherwise, the action will create a new Jira issue based on the Github issue and send a request to Jira to create a new Jira issue by using Jira rest API.

#### Basic Usage

```yaml
name: Sync issues to jira
on:
  issues:
    types: [labeled]　# should be set
jobs:
  issue-sync:
    permissions:
      issues: write # should be set
    runs-on: ubuntu-latest
    steps:
      - name: Sync to Jira
        uses: atsushii/github-issue-to-jira@v1
        with:
          github-owner: github-owner
          github-repo: repository-name
          github-token: ${{ secrets.GITHUB_TOKEN }} # read/write authorized token
          jira-hostname: hostname # Your Sync dest Jira hostname
          jira-auth-token: ${{ secrets.JIRA_AUTH_TOKEN }} # Your Jira auth token
          jira-auth-email: ${{ secrets.JIRA_AUTH_EMAIL }} # email same as jira project creator
          jira-project-key: project-key # Your Sync dest Jira project name
```


### Link to Source Code 
https://github.com/atsushii/github-issue-to-jira

### Permissive License 
https://github.com/atsushii/github-issue-to-jira/blob/main/LICENSE

## Background (What made you decide to build this particular app? What inspired you?) 
As a software engineer who frequently uses Github Actions, I was inspired to create and publish my own custom action. Additionally, since I began contributing to open-source projects, I have found it to be a very rewarding experience. As a result, I wanted to alleviate the pain of OSS maintainers by leveraging technology to the fullest extent possible.

### How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?) 

I started by researching how to sync Github issues to Jira and after a few hours of consideration, I realized that Github Actions would be a good way to implement this feature. This was my first time building and releasing a custom action, and I also had no prior experience using Jira, so I had to learn how to create a token to call the Jira API. To do this, I read the Jira REST API documentation and the GitHub documentation on creating and releasing custom actions.

Throughout the process, I gained new knowledge and skills, which made the experience even more enjoyable. I always find it exciting to learn new things and improve my abilities, and I'm looking forward to continuing to develop and release new versions of my custom action.

### Additional Resources/Info
- I'm a Japanese developer, Let's discuss technology while eating sushi 🍣 🍣