mirror of
https://github.com/joaquinjsb/gitea-release-please-action
synced 2026-05-13 18:11:33 +02:00
build: actually run main() in index.ts (#882)
When converting to typescript we didn't call the main() method if index.ts/js is invoked directly.
This commit is contained in:
4
.github/workflows/release-please.yaml
vendored
4
.github/workflows/release-please.yaml
vendored
@@ -62,7 +62,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build]
|
needs: [build]
|
||||||
steps:
|
steps:
|
||||||
- uses: GoogleCloudPlatform/release-please-action@main
|
- uses: google-github-actions/release-please-action@main
|
||||||
id: release
|
id: release
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -90,7 +90,7 @@ jobs:
|
|||||||
- release-please-release
|
- release-please-release
|
||||||
steps:
|
steps:
|
||||||
- id: release-pr
|
- id: release-pr
|
||||||
uses: GoogleCloudPlatform/release-please-action@main
|
uses: google-github-actions/release-please-action@main
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
|
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
|
||||||
release-type: node
|
release-type: node
|
||||||
|
|||||||
9
dist/index.js
vendored
9
dist/index.js
vendored
@@ -116257,6 +116257,7 @@ function getOptionalBooleanInput(name) {
|
|||||||
}
|
}
|
||||||
function loadOrBuildManifest(github, inputs) {
|
function loadOrBuildManifest(github, inputs) {
|
||||||
if (inputs.releaseType) {
|
if (inputs.releaseType) {
|
||||||
|
core.debug('Building manifest from config');
|
||||||
return release_please_1.Manifest.fromConfig(github, github.repository.defaultBranch, {
|
return release_please_1.Manifest.fromConfig(github, github.repository.defaultBranch, {
|
||||||
releaseType: inputs.releaseType,
|
releaseType: inputs.releaseType,
|
||||||
}, {
|
}, {
|
||||||
@@ -116268,6 +116269,7 @@ function loadOrBuildManifest(github, inputs) {
|
|||||||
fork: inputs.fork,
|
fork: inputs.fork,
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
|
core.debug('Loading manifest from config file');
|
||||||
return release_please_1.Manifest.fromManifest(github, github.repository.defaultBranch, inputs.configFile, inputs.manifestFile, manifestOverrides);
|
return release_please_1.Manifest.fromManifest(github, github.repository.defaultBranch, inputs.configFile, inputs.manifestFile, manifestOverrides);
|
||||||
}
|
}
|
||||||
async function main() {
|
async function main() {
|
||||||
@@ -116275,10 +116277,12 @@ async function main() {
|
|||||||
const github = await getGitHubInstance(inputs);
|
const github = await getGitHubInstance(inputs);
|
||||||
if (!inputs.skipGitHubRelease) {
|
if (!inputs.skipGitHubRelease) {
|
||||||
const manifest = await loadOrBuildManifest(github, inputs);
|
const manifest = await loadOrBuildManifest(github, inputs);
|
||||||
|
core.debug('Creating pull requests');
|
||||||
outputReleases(await manifest.createReleases());
|
outputReleases(await manifest.createReleases());
|
||||||
}
|
}
|
||||||
if (!inputs.skipGitHubPullRequest) {
|
if (!inputs.skipGitHubPullRequest) {
|
||||||
const manifest = await loadOrBuildManifest(github, inputs);
|
const manifest = await loadOrBuildManifest(github, inputs);
|
||||||
|
core.debug('Creating pull requests');
|
||||||
outputPRs(await manifest.createPullRequests());
|
outputPRs(await manifest.createPullRequests());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116356,6 +116360,11 @@ function outputPRs(prs) {
|
|||||||
core.setOutput('prs', JSON.stringify(prs));
|
core.setOutput('prs', JSON.stringify(prs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (require.main === require.cache[eval('__filename')]) {
|
||||||
|
main().catch(err => {
|
||||||
|
core.setFailed(`release-please failed: ${err.message}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
10
src/index.ts
10
src/index.ts
@@ -107,6 +107,7 @@ function loadOrBuildManifest(
|
|||||||
inputs: ActionInputs
|
inputs: ActionInputs
|
||||||
): Promise<Manifest> {
|
): Promise<Manifest> {
|
||||||
if (inputs.releaseType) {
|
if (inputs.releaseType) {
|
||||||
|
core.debug('Building manifest from config');
|
||||||
return Manifest.fromConfig(
|
return Manifest.fromConfig(
|
||||||
github,
|
github,
|
||||||
github.repository.defaultBranch,
|
github.repository.defaultBranch,
|
||||||
@@ -124,6 +125,7 @@ function loadOrBuildManifest(
|
|||||||
fork: inputs.fork,
|
fork: inputs.fork,
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
|
core.debug('Loading manifest from config file');
|
||||||
return Manifest.fromManifest(
|
return Manifest.fromManifest(
|
||||||
github,
|
github,
|
||||||
github.repository.defaultBranch,
|
github.repository.defaultBranch,
|
||||||
@@ -139,11 +141,13 @@ export async function main() {
|
|||||||
|
|
||||||
if (!inputs.skipGitHubRelease) {
|
if (!inputs.skipGitHubRelease) {
|
||||||
const manifest = await loadOrBuildManifest(github, inputs);
|
const manifest = await loadOrBuildManifest(github, inputs);
|
||||||
|
core.debug('Creating pull requests');
|
||||||
outputReleases(await manifest.createReleases());
|
outputReleases(await manifest.createReleases());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inputs.skipGitHubPullRequest) {
|
if (!inputs.skipGitHubPullRequest) {
|
||||||
const manifest = await loadOrBuildManifest(github, inputs);
|
const manifest = await loadOrBuildManifest(github, inputs);
|
||||||
|
core.debug('Creating pull requests');
|
||||||
outputPRs(await manifest.createPullRequests());
|
outputPRs(await manifest.createPullRequests());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,3 +224,9 @@ function outputPRs(prs: (PullRequest | undefined)[]) {
|
|||||||
core.setOutput('prs', JSON.stringify(prs));
|
core.setOutput('prs', JSON.stringify(prs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
main().catch(err => {
|
||||||
|
core.setFailed(`release-please failed: ${err.message}`)
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user