Skip to content

Commit

Permalink
favor credentials from environment
Browse files Browse the repository at this point in the history
  • Loading branch information
k3muri84 committed Feb 3, 2023
1 parent 4ff0631 commit 30aed3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ None of them is dealing with jira.
- setup jira url
- define jira projects in which fix version should be created
- configure possible issue type for your project
- export JIRA_SERVER url, JIRA_USER and JIRA_PASSWORD to environment


### getting version info
currently the script parses a gradle property file, tweak the script to your needs: e.g. pass info via argument, PR
Expand Down
20 changes: 11 additions & 9 deletions generate-changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# install via `pip install jira`
# https://jira.readthedocs.io/en/master/api.html#issue

import os
import sys
import subprocess
import re
Expand All @@ -15,15 +16,6 @@

# ~^~^~^~ user config ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~

# point to your jira installation
jira_server = 'https://jira.yourdomain.com'

"""
configure authentication, see jira module docs for more auth modes
https://jira.readthedocs.io/en/latest/examples.html#authentication
"""
jira = JIRA(server=(jira_server), basic_auth=('changelogbot', 'cryp71cp455w0rd'))

changelogFilename = "CHANGELOG.md"

# configure possible issue types
Expand All @@ -44,6 +36,16 @@

# ^-^-^ END user config ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^

"""
Credentials for authentication should be provided by environment.
Feel free to come up with a more secure option.
See jira module docs for more auth modes
https://jira.readthedocs.io/en/latest/examples.html#authentication
"""
jira_server = os.environ['JIRA_SERVER']
jira_username = os.environ['JIRA_USER']
jira_password = os.environ['JIRA_PASSWORD']
jira = JIRA(server=(jira_server),basic_auth=(jira_username, jira_password))

project_format = r'[A-Z][A-Z\d]+'
git_cmd = 'git log $(git describe --abbrev=0 --tag)..HEAD --format="%s"'
Expand Down

0 comments on commit 30aed3d

Please sign in to comment.