Skip to content

Commit

Permalink
ci: Allow easier action invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
oliversalzburg committed Dec 21, 2023
1 parent 42dd1f8 commit a36ad9e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/action-automatic-releases/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ outputs:
description: "The URL for uploading additional assets to the release"
runs:
using: node20
main: "build/index.js"
main: build/index.js
branding:
icon: "git-merge"
color: "red"
6 changes: 6 additions & 0 deletions packages/action-automatic-releases/source/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { context, getOctokit } from "@actions/github";
import { AutomaticReleases } from "./AutomaticReleases.js";
import { octokitLogger } from "./utils.js";

const isMainModule = import.meta.url.endsWith(process.argv[1]);

export const main = async (): Promise<void> => {
try {
const repo_token = core.getInput("repo_token", { required: true });
Expand All @@ -25,3 +27,7 @@ export const main = async (): Promise<void> => {
throw error;
}
};

if (isMainModule) {
main().catch(console.error);
}
6 changes: 6 additions & 0 deletions packages/action-commit-validator/source/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import core from "@actions/core";
import github from "@actions/github";
import { CommitValidator } from "./CommitValidator.js";

const isMainModule = import.meta.url.endsWith(process.argv[1]);

/**
* Execute the commit validator action.
*/
Expand Down Expand Up @@ -29,3 +31,7 @@ export const main = async (): Promise<void> => {
if (error instanceof Error) core.setFailed(error.message);
}
};

if (isMainModule) {
main().catch(console.error);
}
2 changes: 1 addition & 1 deletion packages/action-label-manager/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ inputs:
description: Needs `secrets.GITHUB_TOKEN` to talk to the API.
runs:
using: node20
main: "build/main.js"
main: build/main.js
6 changes: 6 additions & 0 deletions packages/action-label-manager/source/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { context, getOctokit } from "@actions/github";
import fs from "node:fs/promises";
import { LabelManager } from "./LabelManager.js";

const isMainModule = import.meta.url.endsWith(process.argv[1]);

/**
* Execute the label manager action.
*/
Expand All @@ -25,3 +27,7 @@ export const main = async (): Promise<void> => {
if (error instanceof Error) core.setFailed(error.message);
}
};

if (isMainModule) {
main().catch(console.error);
}

0 comments on commit a36ad9e

Please sign in to comment.