Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
build: actually run main() in index.ts (#882)
Browse files Browse the repository at this point in the history
When converting to typescript we didn't call the main() method if
index.ts/js is invoked directly.
  • Loading branch information
chingor13 authored Nov 30, 2023
1 parent c5182cc commit 546de4e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}, {
Expand All @@ -116268,17 +116269,20 @@ 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() {
const inputs = parseInputs();
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());
}
}
Expand Down Expand Up @@ -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}`);
});
}

})();

Expand Down
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -124,6 +125,7 @@ function loadOrBuildManifest(
fork: inputs.fork,
}
: {};
core.debug('Loading manifest from config file');
return Manifest.fromManifest(
github,
github.repository.defaultBranch,
Expand All @@ -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());
}
}
Expand Down Expand Up @@ -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}`)
})
}

0 comments on commit 546de4e

Please sign in to comment.