Skip to content
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: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Automate releases with Conventional Commit Messages.
| `upload_url` | Directly related to [**Create a release**](https://developer.github.com/v3/repos/releases/#response-4) API |
| `tag_name` | Directly related to [**Create a release**](https://developer.github.com/v3/repos/releases/#response-4) API |
| `fork` | Should the PR be created from a fork (does not work with `secrets.GITHUB_TOKEN`) |
| `command` | release-please command to run, either `github-release`, or `release-pr` (_defaults to running both_) |

### Release types supported

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ inputs:
changelog-types:
description: 'changlelog commit types'
require: false
command:
description: 'release-please command to run, either "github-release", or "release-pr" (defaults to running both)'
require: false
runs:
using: 'node12'
main: 'dist/index.js'
61 changes: 33 additions & 28 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2235,46 +2235,51 @@ async function main () {
const token = core.getInput('token')
const fork = core.getInput('fork') ? true : undefined
const changelogTypes = core.getInput('changelog-types')
const command = core.getInput('command') ? core.getInput('command') : undefined

// Parse the changelogTypes if there are any
let changelogSections = undefined
let changelogSections
if (changelogTypes) {
changelogSections = JSON.parse(changelogTypes)
}

// First we check for any merged release PRs (PRs merged with the label
// "autorelease: pending"):
const gr = new GitHubRelease({
label: RELEASE_LABEL,
repoUrl: process.env.GITHUB_REPOSITORY,
packageName,
path,
token
})
const releaseCreated = await gr.createRelease()
if (releaseCreated) {
// eslint-disable-next-line
const { upload_url, tag_name } = releaseCreated
core.setOutput('release_created', true)
core.setOutput('upload_url', upload_url)
core.setOutput('tag_name', tag_name)
if (!command || command === 'github-release') {
const gr = new GitHubRelease({
label: RELEASE_LABEL,
repoUrl: process.env.GITHUB_REPOSITORY,
packageName,
path,
token
})
const releaseCreated = await gr.createRelease()
if (releaseCreated) {
// eslint-disable-next-line
const { upload_url, tag_name } = releaseCreated
core.setOutput('release_created', true)
core.setOutput('upload_url', upload_url)
core.setOutput('tag_name', tag_name)
}
}

// Next we check for PRs merged since the last release, and groom the
// release PR:
const release = ReleasePRFactory.buildStatic(releaseType, {
monorepoTags,
packageName,
path,
apiUrl: 'https://api.github.com',
repoUrl: process.env.GITHUB_REPOSITORY,
fork,
token: token,
label: RELEASE_LABEL,
bumpMinorPreMajor,
changelogSections
})
await release.run()
if (!command || command === 'release-pr') {
const release = ReleasePRFactory.buildStatic(releaseType, {
monorepoTags,
packageName,
path,
apiUrl: 'https://api.github.com',
repoUrl: process.env.GITHUB_REPOSITORY,
fork,
token: token,
label: RELEASE_LABEL,
bumpMinorPreMajor,
changelogSections
})
await release.run()
}
}

main().catch(err => {
Expand Down
61 changes: 33 additions & 28 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,51 @@ async function main () {
const token = core.getInput('token')
const fork = core.getInput('fork') ? true : undefined
const changelogTypes = core.getInput('changelog-types')
const command = core.getInput('command') ? core.getInput('command') : undefined

// Parse the changelogTypes if there are any
let changelogSections = undefined
let changelogSections
if (changelogTypes) {
changelogSections = JSON.parse(changelogTypes)
}

// First we check for any merged release PRs (PRs merged with the label
// "autorelease: pending"):
const gr = new GitHubRelease({
label: RELEASE_LABEL,
repoUrl: process.env.GITHUB_REPOSITORY,
packageName,
path,
token
})
const releaseCreated = await gr.createRelease()
if (releaseCreated) {
// eslint-disable-next-line
const { upload_url, tag_name } = releaseCreated
core.setOutput('release_created', true)
core.setOutput('upload_url', upload_url)
core.setOutput('tag_name', tag_name)
if (!command || command === 'github-release') {
const gr = new GitHubRelease({
label: RELEASE_LABEL,
repoUrl: process.env.GITHUB_REPOSITORY,
packageName,
path,
token
})
const releaseCreated = await gr.createRelease()
if (releaseCreated) {
// eslint-disable-next-line
const { upload_url, tag_name } = releaseCreated
core.setOutput('release_created', true)
core.setOutput('upload_url', upload_url)
core.setOutput('tag_name', tag_name)
}
}

// Next we check for PRs merged since the last release, and groom the
// release PR:
const release = ReleasePRFactory.buildStatic(releaseType, {
monorepoTags,
packageName,
path,
apiUrl: 'https://api.github.com',
repoUrl: process.env.GITHUB_REPOSITORY,
fork,
token: token,
label: RELEASE_LABEL,
bumpMinorPreMajor,
changelogSections
})
await release.run()
if (!command || command === 'release-pr') {
const release = ReleasePRFactory.buildStatic(releaseType, {
monorepoTags,
packageName,
path,
apiUrl: 'https://api.github.com',
repoUrl: process.env.GITHUB_REPOSITORY,
fork,
token: token,
label: RELEASE_LABEL,
bumpMinorPreMajor,
changelogSections
})
await release.run()
}
}

main().catch(err => {
Expand Down