Skip to content

Commit

Permalink
Merge pull request #3 from wemogy/main
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
SebastianKuesters authored Mar 22, 2024
2 parents d156b97 + 154226d commit 20fa868
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ async function run() {
// Get the referenced issues between the previous release and the current release
const issues = await gitHubRepositoryUtils.getReferencedIssuesBetweenTags(
previousReleaseVersionTag,
releaseVersionTag
releaseVersionTag,
"release"
);

// Create the release notes
Expand Down
19 changes: 13 additions & 6 deletions src/utils/GitHubRepositoryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ export default class GitHubRepositoryUtils {

public async getReferencedIssuesBetweenTags(
startTag: string,
endTag: string
endTag: string,
branch: string = "main"
) {
// Get all issues and PRs between start and end tag
const issuesAndPrs = await this.getReferencedIssuesAndPrsBetweenTags(
startTag,
endTag
endTag,
branch
);

// Flatten issues and PRs
Expand All @@ -26,9 +28,10 @@ export default class GitHubRepositoryUtils {

public async getReferencedIssuesAndPrsBetweenTags(
startTag: string,
endTag: string
endTag: string,
branch: string = "main"
) {
const commits = await this.getCommitsBetweenTags(startTag, endTag);
const commits = await this.getCommitsBetweenTags(startTag, endTag, branch);

// Get all referenced issues and PRs from the commit messages
const referencedIssuesAndPrs = commits
Expand Down Expand Up @@ -131,7 +134,11 @@ export default class GitHubRepositoryUtils {
}
}

public async getCommitsBetweenTags(startTag: string, endTag: string) {
public async getCommitsBetweenTags(
startTag: string,
endTag: string,
branch: string = "main"
) {
// destructuring
const { owner, repo, octokit } = this;

Expand All @@ -148,7 +155,7 @@ export default class GitHubRepositoryUtils {
await octokit.repos.listCommits({
owner,
repo,
branch: "main",
branch,
})
).data.pop();

Expand Down

0 comments on commit 20fa868

Please sign in to comment.