Skip to content

Commit 6520068

Browse files
authored
Merge pull request #60 from step-security/fix/subscription
fix: fixed subscription check code
2 parents 1d8c807 + e0166ea commit 6520068

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

dist/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ const github_1 = __nccwpck_require__(5438);
4444
const shorten_1 = __nccwpck_require__(1872);
4545
const axios_1 = __importStar(__nccwpck_require__(8757));
4646
function validateSubscription() {
47+
var _a;
4748
return __awaiter(this, void 0, void 0, function* () {
4849
const API_URL = `https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/subscription`;
4950
try {
5051
yield axios_1.default.get(API_URL, { timeout: 3000 });
5152
}
5253
catch (error) {
53-
if ((0, axios_1.isAxiosError)(error) && error.response) {
54+
if ((0, axios_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 403) {
5455
core.error('Subscription is not valid. Reach out to [email protected]');
5556
process.exit(1);
5657
}

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async function validateSubscription(): Promise<void> {
99
try {
1010
await axios.get(API_URL, {timeout: 3000})
1111
} catch (error) {
12-
if (isAxiosError(error) && error.response) {
12+
if (isAxiosError(error) && error.response?.status === 403) {
1313
core.error(
1414
'Subscription is not valid. Reach out to [email protected]'
1515
)

0 commit comments

Comments
 (0)