Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ const helpers_1 = require("./helpers");
const processor_1 = require("./processor");
const processor = new processor_1.Processor();
async function validateSubscription() {
var _a;
const API_URL = `https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/subscription`;
try {
await axios_1.default.get(API_URL, { timeout: 3000 });
}
catch (error) {
if ((0, axios_1.isAxiosError)(error) && error.response) {
if ((0, axios_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 403) {
core.error('Subscription is not valid. Reach out to support@stepsecurity.io');
process.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function validateSubscription(): Promise<void> {
try {
await axios.get(API_URL, {timeout: 3000})
} catch (error) {
if (isAxiosError(error) && error.response) {
if (isAxiosError(error) && error.response?.status === 403) {
core.error(
'Subscription is not valid. Reach out to support@stepsecurity.io'
)
Expand Down
4 changes: 2 additions & 2 deletions test/index.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as execa from "execa";
import { ddb, DYNAMODB_ENDPOINT, tableName, toJS } from "./helper";

export async function invokeAction(input: { [key: string]: string | undefined }) {
const res = await execa("ts-node", ["src/index.ts"], {
const res = await execa.execa("ts-node", ["src/index.ts"], {
preferLocal: true,
env: Object.fromEntries(
Object.entries(input).map(([key, value]) => [`INPUT_${key.toUpperCase()}`, value]),
Expand Down Expand Up @@ -38,7 +38,7 @@ describe("dynamodb-actions", () => {

expect(e).to.eq(null);
expect(res?.exitCode).to.eq(0);
expect(res?.stdout).to.eq(`::set-output name=item::{"value":"bar","createdAt":12345,"key":"foo"}`);
expect(res?.stdout).to.eq(`\n::set-output name=item::{"value":"bar","createdAt":12345,"key":"foo"}`);
});
});

Expand Down
Loading