Skip to content

Commit

Permalink
Handle the case where there is no prior release (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
JAForbes authored Jan 9, 2022
1 parent 2f12f30 commit 614026c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
14 changes: 9 additions & 5 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ description: Use Pull Requests to generate npm + github releases and changelogs

## Quick Start

1. Run `npx pr-release actions-yml`
2. Commit changes to your project and push
3. Generate a [Personal Access Token](/env/#personal-access-token) and [NPM token](/env/#npm-token)
4. Add them to your [project's environment settings](/env/#environment-settings)
5. You now have an automated release pipeline

1. Create a branch called `next` and set it as the default branch for the repo
2. Create a branch called `main`
3. Make both `next` and `main` protected branches
4. Run `npx pr-release actions-yml`
5. Commit changes to your project and push to `next`, then merge `next` into `main`
6. Generate a [Personal Access Token](/env/#personal-access-token) and [NPM token](/env/#npm-token)
7. Add them to your [project's environment settings](/env/#environment-settings)
8. You now have an automated release pipeline
26 changes: 18 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,24 @@ async function extractChangelog(options){
b = _b
}

let recentBranches =
await octokit.paginate(octokit.rest.search.issuesAndPullRequests, {
q: `merged:${a.closed_at}..${b.closed_at} base:${source} is:pr is:merged repo:${owner}/${repo}`
,sort: 'updated'
,order: 'desc'
,per_page: 2
,page: 1
})

let recentBranches; {

let firstEverRelease = a == null;

let q = firstEverRelease
? `base:${source} is:pr is:merged repo:${owner}/${repo}`
: `merged:${a.closed_at}..${b.closed_at} base:${source} is:pr is:merged repo:${owner}/${repo}`

recentBranches =
await octokit.paginate(octokit.rest.search.issuesAndPullRequests, {
q
,sort: 'updated'
,order: 'desc'
,per_page: 2
,page: 1
})
}

let openBranches =
await getRecentBranches({ owner, repo, lastRelease })
Expand Down

0 comments on commit 614026c

Please sign in to comment.