Skip to content

Commit

Permalink
ts->js
Browse files Browse the repository at this point in the history
  • Loading branch information
yurii-glia committed Oct 18, 2023
1 parent 671b86d commit 037d5ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .github/actions/deployment-action/deployment-action.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
const core = require('@actions/core');
const github = require('@actions/github');

"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
var core = require("@actions/core");
var github = require("@actions/github");
try {
const branchName = core.getInput("branch-name");
console.log(`The branch name is "${branchName}" from param.`);

const ref = github.context.payload.pull_request["head"]["ref"]
var ref = (_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a["head"]["ref"];
console.log(ref);
} catch(error) {
if (ref == 'master' || (ref === null || ref === void 0 ? void 0 : ref.startsWith('release')) == true) { }
else {
core.setFailed("'".concat(ref, "' branch can't be released. Only 'master' or 'release/*' branches can be released."));
}
}
catch (error) {
core.setFailed(error.message);
}
}
14 changes: 14 additions & 0 deletions .github/actions/deployment-action/deployment-action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as core from '@actions/core';
import * as github from '@actions/github';

try {
const ref = github.context.payload.pull_request?.["head"]["ref"] as string | null | undefined;
console.log(ref);

if (ref == 'master' || ref?.startsWith('release') == true) {} else {
core.setFailed(`'${ref}' branch can't be released. Only 'master' or 'release/*' branches can be released.`);
core.setOutput(`'${ref}' branch can't be released. Only 'master' or 'release/*' branches can be released.`, 'forbidden');
}
} catch(error) {
core.setFailed(error.message);
}

0 comments on commit 037d5ff

Please sign in to comment.