Installations
npm install jira-changelog
Releases
Bug fix and library updates
Published on 24 Jun 2021
v2.1.0
Published on 12 Apr 2021
Git range fix + enhancements
Published on 24 Mar 2021
Fix AllHtmlEntities error
Published on 13 Apr 2020
Disable symmetric comparison
Published on 12 Mar 2020
Version 1.6.0 - Less noise, more signal
Published on 20 Feb 2020
Developer
jgillick
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
14.15.0
NPM Version
7.6.3
Statistics
87 Stars
72 Commits
34 Forks
4 Watching
10 Branches
9 Contributors
Updated on 30 Aug 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
484,624
Last day
6.7%
554
Compared to previous day
Last week
60.2%
2,518
Compared to previous week
Last month
-38.5%
58,372
Compared to previous month
Last year
144.3%
198,283
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Jira Changelog Generator
Generates a changelog of Jira issues from your git history and, optionally, attach all issues to a release.
For example:
1$ jira-changelog --range origin/prod...origin/master
Jira Tickets
---------------------
* <Bug> - Unable to access date widget
[DEV-1234] https://yoursite.atlassian.net/browse/DEV-1234
* <Story> - Support left-handed keyboards
[DEV-5678] https://yoursite.atlassian.net/browse/DEV-5678
* <Story> - Search by location
[DEV-8901] https://yoursite.atlassian.net/browse/DEV-8901
Other Commits
---------------------
* <cd6f512> - Fix typo in welcome message
Pending Approval
---------------------
~ None. Yay! ~
You can also have it automatically post to slack!
How it works
The script looks for Jira issue keys, surrounded by square brackets (i.e. [DEV-123]
), in the git commit logs. When it finds one, it associates that Jira issue ticket with that commit and adds it to the changelog.
Installation
1npm install -g jira-changelog
JIRA setup
Before configuring the app, register a new user in Jira for the app to use to retrieve and update tickets. Then create an Auth Token for this user, which will be used for authentication. Jira no longer supports authenticating with password for API calls.
Configuration
Create a file called changelog.config.js
and put it at the root of your git workspace directory. This is also where you'll call the jira-changelog
command from.
Here's a simple example with sample Jira API values:
1module.exports = { 2 jira: { 3 api: { 4 host: 'myapp.atlassian.net', 5 email: 'jirauser@myapp.com', 6 token: 'qWoJBdlEp6pJy15fc9tGpsOOR2L5i35v', 7 options: {} 8 }, 9 } 10}
The token is the API token assigned to this user. To see all values supported, look at the changelog.config.js file at the root of this repo.
Use the options object to set jira-client options. See official docs for available options.
Usage
1jira-changelog --range origin/prod...origin/master
Assuming you deploy from a branch named prod
, this will generate a changelog with all commits after the last production deploy to the current master version (You can change the default branch names with the sourceControl.defaultRange
object, in your config).
1jira-changelog
Alternatively, you can specify a range (using git commit range format) in the command:
1jira-changelog --range origin/prod...origin/stage
Releases
You can automatically attach a release to all Jira issues in the changelog with the --release
flag. For example, let's say we want to add all issues in the changelog to the "sprint-12" release:
1jira-changelog --release sprint-12
This will set the fixVersions
of all issues to "sprint-12" in Jira.
Slack
The script can also automatically post the changelog to slack.
First, get an API token from Slack for your workspace: https://api.slack.com/tokens
Then add slack to your configuration file:
1module.exports = { 2 ... 3 slack: { 4 apiKey: 'asdlfkjasdoifuoiucvlkxjcvoixucvi', 5 channel: '#changelogs' 6 }, 7}
- Add your API token to
slack.apiKey
. slack.channel
is the channel you want the script to send the changelog to.
Then simply add the --slack
flag to the command:
1jira-changelog --slack
API
The code used to generate the changelogs can also be used as modules in your node app. See the module source for documentation.
For example:
1npm install -S jira-changelog
1const Config = require('jira-changelog').Config; 2const SourceControl = require('jira-changelog').SourceControl; 3const Jira = require('jira-changelog').Jira; 4 5const gitRepoPath = '/home/user/source/' 6 7// Get configuration 8const confPath = `${gitRepoPath}/changelog.config.js`; 9const config = Config.readConfigFile('/Users/jeremygillick/Source/app/changelog.config.js'); 10 11// Get commits for a range 12const source = new SourceControl(config); 13const range = { 14 from: "origin/prod", 15 to: "origin/master" 16}; 17source.getCommitLogs(gitRepoPath, range).then((commitLogs) => { 18 19 // Associate git commits with jira tickets and output changelog object 20 const jira = new Jira(config); 21 jira.generate(commitLogs).then((changelog) => { 22 console.log(changelog); 23 }); 24 25});
Tips & Tricks
Change the output
The output of the changelog is controlled by an ejs template defined in your changelog.config.js
file. You can see the default template, here:
https://github.com/jgillick/jira-changelog/blob/master/changelog.config.js#L95-L136
The data sent to the template looks like this:
{
jira: {
baseUrl: "...",
releaseVersions: [],
},
commits: {
all: [], // all commits
tickets: [], // commits associated with jira tickets
noTickets: [], // commits not associated with jira tickets
},
tickets: {
all: [], // all tickets
approved: [], // tickets marked as approved
pending: [], // tickets not marked as approved
pendingByOwner: [], // pending tickets arranged under ticket reporters.
}
}
The template should output data only, not perform data transformations. For that, define the transformData
or transformForSlack
functions.
Custom data transformation
What if you want to edit the git commit log messages to automatically add links around the ticket numbers? You can do that, and more, by defining the transformData
function inside your changelog.config.js
file. This function can transform all the template data, before it is sent to the template.
For example, adding a link around all ticket numbers in the git logs would look something like this (overly simplistic, for example only):
1transformData: (data) => { 2 // Link the ticket numbers in all commit summaries. 3 data.commits.all.forEach((commit) => { 4 commit.summary = commit.summary.replace( 5 /\[([A-Z]+\-[0-9]+)\]/, 6 '[<a href="https://YOU.atlassian.net/browse/$1">$1</a>]' 7 ); 8 }); 9 return data; 10},
Then, if you want to create slack specific data transformations, define the transformForSlack
function. This function will be called after transformData
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 6/25 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 12 are checked with a SAST tool
Reason
28 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q
- Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-3f95-r44v-8mrg
- Warn: Project is vulnerable to: GHSA-28xr-mwxg-3qc8
- Warn: Project is vulnerable to: GHSA-9p95-fxvg-qgq2
- Warn: Project is vulnerable to: GHSA-9w5j-4mwv-2wj8
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
2
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More