Skip to content

SP-2020 remove releaseDate and customfield_11108 usage #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ A GitHub action that uses a tag name and a list of Issue-IDs and updates their r
- `issueIds` (required) - Comma separated list of Jira issues to update. Example: RE-1486,RE-1489
- `componentName` (required) - The name of the component (service) to add as label to the issues
- `tagName` (required) - The (git) release tag to add as label to the issues
- `releaseDate` (optional) - The date to use as release date, default is 'now'
- `notifyUsers` (optional) - Whether to notify user watching the Jira issues, default is 'false'

## Contributing
Expand Down
3 changes: 1 addition & 2 deletions __tests__/jira.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ xtest('foo', async () => {
const result = await jira.updateIssues({
issueIds: ['RE-1486', 'RE-1489'],
componentName: 'foo-service',
tagName: '2020.8.4',
releaseDate: new Date(),
tagName: '2020.8.4'
})

expect(result).toEqual([])
Expand Down
6 changes: 2 additions & 4 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const arn = new Arn({webhookUrl});
// 1. update JIRA issues
// 2. send a webhook to the ARN (Automated release notes) - JIRA app -
// with the componentName-tagName label
async function exec ({ issueIds, componentName, tagName, releaseDate }) {
async function exec ({ issueIds, componentName, tagName }) {
try {
console.log({ issueIds, componentName, tagName, releaseDate });
console.log({ issueIds, componentName, tagName });

if (issueIds.length === 0) {
console.log('No Jira issues given, do nothing');
Expand All @@ -29,7 +29,6 @@ async function exec ({ issueIds, componentName, tagName, releaseDate }) {
issueIds,
componentName,
tagName,
releaseDate,
});

if (errors.length === 0) {
Expand All @@ -51,7 +50,6 @@ function parseArgs() {
issueIds: filterIssueIds(core.getInput('issueIds')),
componentName: core.getInput('componentName'),
tagName: core.getInput('tagName') || process.env.TAGNAME,
releaseDate: core.getInput('releaseDate') ? new Date(core.getInput('releaseDate')) : new Date(),
notifyUsers: core.getInput('notifyUsers') === 'true',
}
}
Expand Down
3 changes: 0 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ inputs:
tagName:
description: "The (git) release tag to add as label to the issues"
required: true
releaseDate:
description: "The date to use as release date, default is 'now'"
required: false
notifyUsers:
description: "Whether to notify user watching the Jira issues, default is 'false'"
required: false
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

17 changes: 3 additions & 14 deletions jira.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,12 @@ class Jira {
return issue;
}

async updateIssues ({ issueIds, releaseDate, tagName, componentName, notifyUsers = false }) {
async updateIssues ({ issueIds, tagName, componentName, notifyUsers = false }) {
const calls = issueIds.map(async (issueId) => {
try {
const issue = await this.getIssueOrSubtaskParentIssue(issueId);

if (issue.fields.customfield_11108) {
const oldReleaseDate = new Date(issue.fields.customfield_11108);

if (oldReleaseDate > releaseDate) {
releaseDate = oldReleaseDate
}
}

await this.updateIssue({ issue, releaseDate, tagName, componentName, notifyUsers });
await this.updateIssue({ issue, tagName, componentName, notifyUsers });

return null
} catch (ex) {
Expand All @@ -63,7 +55,7 @@ class Jira {

// PUT /rest/api/3/issue/{issueIdOrKey}
// see: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-rest-api-3-issue-issueIdOrKey-put
async updateIssue ({ issue, releaseDate, tagName, componentName, notifyUsers }) {
async updateIssue ({ issue, tagName, componentName, notifyUsers }) {
const issueId = issue.key;
//console.log('Updating ' + issueId);
const response = await fetch(`${this.baseUrl}/rest/api/3/issue/${issueId}?notifyUsers=${notifyUsers}`, {
Expand All @@ -83,9 +75,6 @@ class Jira {
},
],
},
fields: {
customfield_11108: releaseDate.toISOString(),
},
}),
});

Expand Down