Skip to content

Commit eec9014

Browse files
committed
Allow validated issue status to be set in configuration
1 parent 6906f35 commit eec9014

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ The following environment variables are expected. If a `.env` file is present,
3333
# Hostname of your Jira instance.
3434
JIRA_URL=unicode-org.atlassian.net
3535
36-
# Hostname of your GitHub instance
37-
GITHUB_URL=https://github.mycompany.com/api/v3
38-
3936
# Authentication for your Jira instance.
4037
# If not present, authentication for Jira will not be used.
4138
#
@@ -44,6 +41,9 @@ GITHUB_URL=https://github.mycompany.com/api/v3
4441
4542
JIRA_PASSWORD=bar
4643
44+
# List of issue statuses that would be accepted
45+
JIRA_APPROVED_STATUSES="Approved, Progress"
46+
4747
# URL prefix used for hyperlinks.
4848
URL_PREFIX=http://localhost:3000
4949
@@ -65,6 +65,9 @@ [email protected]
6565
# Secret for the cookie session, used to store the user's GitHub access token in a cookie.
6666
COOKIE_SECRET=xxxxxxxxxx
6767
68+
# Hostname of your GitHub instance
69+
GITHUB_URL=https://github.mycompany.com/api/v3
70+
6871
# GitHub permissions:
6972
7073
# Option 1: Personal Access Token; easiest and useful for testing.

app.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ async function getJiraInfo(pullRequest) {
7474
const isMaintMerge = (pullRequest.base.ref === "master"
7575
&& pullRequest.head.ref.match(/^maint\//)
7676
&& pullRequest.base.repo.full_name == pullRequest.head.repo.full_name);
77+
let jiraApprovedStatuses = process.env.JIRA_APPROVED_STATUSES || "Accepted, Reviewing, Review Feedback"
78+
const jiraApprovedStatusesArray = jiraApprovedStatuses.split(",").map(status => status.trim())
7779

7880
// Check Jira ticket for validity
79-
if (jiraStatus !== "Accepted" &&
80-
jiraStatus !== "Reviewing" &&
81-
jiraStatus !== "Review Feedback") {
81+
if (!jiraApprovedStatuses.includes(jiraStatus)) {
8282
return {
8383
issueKey,
8484
jiraStatus,
@@ -121,7 +121,7 @@ async function getJiraInfo(pullRequest) {
121121
}
122122
}
123123

124-
// Since we can't easilly check more than 100 commits, reject PRs with more than 100 commits
124+
// Since we can't easily check more than 100 commits, reject PRs with more than 100 commits
125125
if (commits.length === 100) {
126126
return {
127127
issueKey,

0 commit comments

Comments
 (0)