-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added README file Added prettier and ran code through it Converted code from using axios to using got Introduced jira-client to reuse between functions Instead of 'require' use 'import' statements
- Loading branch information
0 parents
commit 433c709
Showing
15 changed files
with
1,974 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist | ||
coverage | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Ignore artifacts: | ||
coverage | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Jira Release github action | ||
|
||
The purpose of this github action is to synchronize Releases in Github with the Releases in Jira (Cloud). | ||
|
||
## How it works | ||
|
||
When a new Pre-Release is published in Github (essentially, when a new tag is created), the event is emitted to which Github Actions enabled for the repository can react. | ||
The action will fetch details about the Release - the name and the tag. Then, it will grab the last 2 tags and, will get the change log between those, loop through each commit, and from the commit summary will try to extract the JIRA issue number. | ||
|
||
**WARNING**: The action is built with the assumption that commit messages are written in a certain format: `JIRA-123: Commit summary message` (actually, it's a format supported by the commitizen project, see <https://www.npmjs.com/package/commitlint-config-jira>). | ||
|
||
Next, the Action will go to Jira and create a new Release named after the repository name concatenated via '-' with the tag name (if tag starts with the `v` prefix, then this prefix will be dropped). The title of the Github Release will be used as a description of the Release in Jira. | ||
|
||
**Example:** | ||
|
||
 | ||
|
||
Eventually, the Action will update all the relevant Jira tickets with the "Fix versions" set to the current Jira Release name.\ | ||
Keep in mind that the version will be appended to already existing versions on the ticket with the `update` operation: | ||
|
||
 | ||
|
||
## How to use | ||
|
||
In the `.github/` directory within the repository create a new workflow file with the contents like this: | ||
|
||
```yaml | ||
name: Sync Github and Jira release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
jira_release: | ||
timeout-minutes: 5 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Create Jira Release | ||
id: jira-release | ||
uses: rodush/github-actions-jira-release@v1 | ||
with: | ||
project_id: 13327 | ||
project_key: "TRS" | ||
env: | ||
JIRA_API_USER: ${{ secrets.ATLASSIAN_CLOUD_USER }} | ||
JIRA_API_TOKEN: ${{ secrets.ATLASSIAN_CLOUD_APIKEY }} | ||
ATLASSIAN_CLOUD_DOMAIN: ${{ secrets.ATLASSIAN_CLOUD_DOMAIN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
The example above expects a list of certain secrets available in the repository: | ||
- `ATLASSIAN_CLOUD_USER` | ||
- `ATLASSIAN_CLOUD_APIKEY` | ||
- `ATLASSIAN_CLOUD_DOMAIN` | ||
|
||
### Action inputs | ||
|
||
The action requires 2 input parameters provided: | ||
|
||
- `project_id` , used in the API calls | ||
- `project_key`, used in the regular expression to extract Jira ticket number from the commit summary message | ||
|
||
It also requires 4 environment variables: | ||
|
||
- `JIRA_API_USER` | ||
- `JIRA_API_TOKEN` | ||
- `ATLASSIAN_CLOUD_DOMAIN` | ||
- `GITHUB_TOKEN` | ||
|
||
### Permissions | ||
|
||
The API user to communicate with Jira needs to have the "Admin" rights for a project where Releases are to be created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: 'Create Jira Release' | ||
description: 'Creates new Jira Release (version) when Github release is published' | ||
inputs: | ||
project_id: | ||
description: 'Id of the Jira project (int64)' | ||
required: true | ||
project_key: | ||
description: 'Project key. Used to pick ticket ids from the commit messages' | ||
required: true | ||
default: "SLI" | ||
outputs: | ||
jira_release_id: | ||
description: 'Jira Release ID' | ||
jira_release_name: | ||
description: 'Jira Release Name' | ||
runs: | ||
using: 'node12' | ||
main: 'dist/index.js' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.