mirror of
https://github.com/joaquinjsb/gitea-release-please-action
synced 2026-05-13 23:01:30 +02:00
fix(release-please): upgrade release-please dep (#422)
Upgrade release-please dep, address issue with manifest configuration maintaining state between tagging releases and creating release PRs.
This commit is contained in:
85
index.js
85
index.js
@@ -37,7 +37,7 @@ async function runManifest (command) {
|
|||||||
const { fork } = getGitHubInput()
|
const { fork } = getGitHubInput()
|
||||||
const manifestOpts = getManifestInput()
|
const manifestOpts = getManifestInput()
|
||||||
const github = await getGitHubInstance()
|
const github = await getGitHubInstance()
|
||||||
const manifest = await Manifest.fromManifest(
|
let manifest = await Manifest.fromManifest(
|
||||||
github,
|
github,
|
||||||
github.repository.defaultBranch,
|
github.repository.defaultBranch,
|
||||||
manifestOpts.configFile,
|
manifestOpts.configFile,
|
||||||
@@ -49,8 +49,19 @@ async function runManifest (command) {
|
|||||||
)
|
)
|
||||||
// Create or update release PRs:
|
// Create or update release PRs:
|
||||||
outputPRs(await manifest.createPullRequests())
|
outputPRs(await manifest.createPullRequests())
|
||||||
if (command === 'manifest-pr') return
|
if (command !== 'manifest-pr') {
|
||||||
outputReleases(await manifest.createReleases())
|
manifest = await Manifest.fromManifest(
|
||||||
|
github,
|
||||||
|
github.repository.defaultBranch,
|
||||||
|
manifestOpts.configFile,
|
||||||
|
manifestOpts.manifestFile,
|
||||||
|
{
|
||||||
|
signoff,
|
||||||
|
fork
|
||||||
|
}
|
||||||
|
)
|
||||||
|
outputReleases(await manifest.createReleases())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main () {
|
async function main () {
|
||||||
@@ -58,7 +69,42 @@ async function main () {
|
|||||||
if (MANIFEST_COMMANDS.includes(command)) {
|
if (MANIFEST_COMMANDS.includes(command)) {
|
||||||
return await runManifest(command)
|
return await runManifest(command)
|
||||||
}
|
}
|
||||||
|
const github = await getGitHubInstance()
|
||||||
|
|
||||||
|
// First we check for any merged release PRs (PRs merged with the label
|
||||||
|
// "autorelease: pending"):
|
||||||
|
if (!command || command === GITHUB_RELEASE_COMMAND) {
|
||||||
|
const manifest = await manifestInstance(github)
|
||||||
|
outputReleases(await manifest.createReleases())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next we check for PRs merged since the last release, and groom the
|
||||||
|
// release PR:
|
||||||
|
if (!command || command === GITHUB_RELEASE_PR_COMMAND) {
|
||||||
|
const manifest = await manifestInstance(github)
|
||||||
|
outputPRs(await manifest.createPullRequests())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const releasePlease = {
|
||||||
|
main
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGitHubInstance () {
|
||||||
|
const { token, defaultBranch, apiUrl, graphqlUrl, repoUrl } = getGitHubInput()
|
||||||
|
const [owner, repo] = repoUrl.split('/')
|
||||||
|
const githubCreateOpts = {
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
apiUrl,
|
||||||
|
graphqlUrl,
|
||||||
|
token
|
||||||
|
}
|
||||||
|
if (defaultBranch) githubCreateOpts.defaultBranch = defaultBranch
|
||||||
|
return GitHub.create(githubCreateOpts)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function manifestInstance (github) {
|
||||||
const { fork } = getGitHubInput()
|
const { fork } = getGitHubInput()
|
||||||
const bumpMinorPreMajor = core.getBooleanInput('bump-minor-pre-major')
|
const bumpMinorPreMajor = core.getBooleanInput('bump-minor-pre-major')
|
||||||
const bumpPatchForMinorPreMajor = core.getBooleanInput('bump-patch-for-minor-pre-major')
|
const bumpPatchForMinorPreMajor = core.getBooleanInput('bump-patch-for-minor-pre-major')
|
||||||
@@ -71,11 +117,10 @@ async function main () {
|
|||||||
const changelogSections = changelogTypes && JSON.parse(changelogTypes)
|
const changelogSections = changelogTypes && JSON.parse(changelogTypes)
|
||||||
const versionFile = core.getInput('version-file') || undefined
|
const versionFile = core.getInput('version-file') || undefined
|
||||||
const extraFiles = core.getMultilineInput('extra-files') || undefined
|
const extraFiles = core.getMultilineInput('extra-files') || undefined
|
||||||
const github = await getGitHubInstance()
|
|
||||||
const pullRequestTitlePattern = core.getInput('pull-request-title-pattern') || undefined
|
const pullRequestTitlePattern = core.getInput('pull-request-title-pattern') || undefined
|
||||||
const draft = core.getBooleanInput('draft')
|
const draft = core.getBooleanInput('draft')
|
||||||
const draftPullRequest = core.getBooleanInput('draft-pull-request')
|
const draftPullRequest = core.getBooleanInput('draft-pull-request')
|
||||||
const manifest = await Manifest.fromConfig(
|
return await Manifest.fromConfig(
|
||||||
github,
|
github,
|
||||||
github.repository.defaultBranch,
|
github.repository.defaultBranch,
|
||||||
{
|
{
|
||||||
@@ -98,36 +143,6 @@ async function main () {
|
|||||||
},
|
},
|
||||||
path
|
path
|
||||||
)
|
)
|
||||||
|
|
||||||
// First we check for any merged release PRs (PRs merged with the label
|
|
||||||
// "autorelease: pending"):
|
|
||||||
if (!command || command === GITHUB_RELEASE_COMMAND) {
|
|
||||||
outputReleases(await manifest.createReleases())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next we check for PRs merged since the last release, and groom the
|
|
||||||
// release PR:
|
|
||||||
if (!command || command === GITHUB_RELEASE_PR_COMMAND) {
|
|
||||||
outputPRs(await manifest.createPullRequests())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const releasePlease = {
|
|
||||||
main
|
|
||||||
}
|
|
||||||
|
|
||||||
function getGitHubInstance () {
|
|
||||||
const { token, defaultBranch, apiUrl, graphqlUrl, repoUrl } = getGitHubInput()
|
|
||||||
const [owner, repo] = repoUrl.split('/')
|
|
||||||
const githubCreateOpts = {
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
apiUrl,
|
|
||||||
graphqlUrl,
|
|
||||||
token
|
|
||||||
}
|
|
||||||
if (defaultBranch) githubCreateOpts.defaultBranch = defaultBranch
|
|
||||||
return GitHub.create(githubCreateOpts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputReleases (releases) {
|
function outputReleases (releases) {
|
||||||
|
|||||||
2055
package-lock.json
generated
2055
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -26,12 +26,12 @@
|
|||||||
"homepage": "https://github.com/bcoe/release-please-action#readme",
|
"homepage": "https://github.com/bcoe/release-please-action#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.6.0",
|
"@actions/core": "^1.6.0",
|
||||||
"release-please": "^13.3.1"
|
"release-please": "^13.4.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/ncc": "^0.27.0",
|
"@vercel/ncc": "^0.27.0",
|
||||||
"c8": "^7.5.0",
|
"c8": "^7.5.0",
|
||||||
"mocha": "^9.1.3",
|
"mocha": "^9.1.4",
|
||||||
"nock": "^13.2.1",
|
"nock": "^13.2.1",
|
||||||
"sinon": "^9.2.4",
|
"sinon": "^9.2.4",
|
||||||
"standard": "^16.0.4"
|
"standard": "^16.0.4"
|
||||||
|
|||||||
@@ -139,9 +139,9 @@ describe('release-please-action', () => {
|
|||||||
})
|
})
|
||||||
await action.main()
|
await action.main()
|
||||||
|
|
||||||
sinon.assert.calledOnce(createManifestCommand)
|
sinon.assert.calledTwice(createManifestCommand)
|
||||||
sinon.assert.calledOnce(createPullRequestsFake)
|
sinon.assert.calledOnce(createPullRequestsFake)
|
||||||
sinon.assert.calledWith(createReleasesFake)
|
sinon.assert.calledOnce(createReleasesFake)
|
||||||
assert.deepStrictEqual(output, {
|
assert.deepStrictEqual(output, {
|
||||||
release_created: true,
|
release_created: true,
|
||||||
upload_url: 'http://example.com',
|
upload_url: 'http://example.com',
|
||||||
|
|||||||
Reference in New Issue
Block a user