1
0
mirror of https://github.com/joaquinjsb/gitea-release-please-action synced 2026-05-09 05:21:12 +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:
Jeff Ching
2023-11-30 12:33:12 -08:00
committed by GitHub
parent c5182cc8b1
commit 546de4e1ec
3 changed files with 21 additions and 2 deletions

View File

@@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: GoogleCloudPlatform/release-please-action@main
- uses: google-github-actions/release-please-action@main
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
@@ -90,7 +90,7 @@ jobs:
- release-please-release
steps:
- id: release-pr
uses: GoogleCloudPlatform/release-please-action@main
uses: google-github-actions/release-please-action@main
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
release-type: node

9
dist/index.js vendored
View File

@@ -116257,6 +116257,7 @@ function getOptionalBooleanInput(name) {
}
function loadOrBuildManifest(github, inputs) {
if (inputs.releaseType) {
core.debug('Building manifest from config');
return release_please_1.Manifest.fromConfig(github, github.repository.defaultBranch, {
releaseType: inputs.releaseType,
}, {
@@ -116268,6 +116269,7 @@ function loadOrBuildManifest(github, inputs) {
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);
}
async function main() {
@@ -116275,10 +116277,12 @@ async function main() {
const github = await getGitHubInstance(inputs);
if (!inputs.skipGitHubRelease) {
const manifest = await loadOrBuildManifest(github, inputs);
core.debug('Creating pull requests');
outputReleases(await manifest.createReleases());
}
if (!inputs.skipGitHubPullRequest) {
const manifest = await loadOrBuildManifest(github, inputs);
core.debug('Creating pull requests');
outputPRs(await manifest.createPullRequests());
}
}
@@ -116356,6 +116360,11 @@ function outputPRs(prs) {
core.setOutput('prs', JSON.stringify(prs));
}
}
if (require.main === require.cache[eval('__filename')]) {
main().catch(err => {
core.setFailed(`release-please failed: ${err.message}`);
});
}
})();

View File

@@ -107,6 +107,7 @@ function loadOrBuildManifest(
inputs: ActionInputs
): Promise<Manifest> {
if (inputs.releaseType) {
core.debug('Building manifest from config');
return Manifest.fromConfig(
github,
github.repository.defaultBranch,
@@ -124,6 +125,7 @@ function loadOrBuildManifest(
fork: inputs.fork,
}
: {};
core.debug('Loading manifest from config file');
return Manifest.fromManifest(
github,
github.repository.defaultBranch,
@@ -139,11 +141,13 @@ export async function main() {
if (!inputs.skipGitHubRelease) {
const manifest = await loadOrBuildManifest(github, inputs);
core.debug('Creating pull requests');
outputReleases(await manifest.createReleases());
}
if (!inputs.skipGitHubPullRequest) {
const manifest = await loadOrBuildManifest(github, inputs);
core.debug('Creating pull requests');
outputPRs(await manifest.createPullRequests());
}
}
@@ -220,3 +224,9 @@ function outputPRs(prs: (PullRequest | undefined)[]) {
core.setOutput('prs', JSON.stringify(prs));
}
}
if (require.main === module) {
main().catch(err => {
core.setFailed(`release-please failed: ${err.message}`)
})
}