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 23, 2023
1 parent 60f9d5c commit e431b8c
Show file tree
Hide file tree
Showing 529 changed files with 190,485 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .github/actions/deployment-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'Deployment validation'
description: 'Validates if deployment action can be run'
inputs:
branch-name:
description: 'The branch name should be validated'
required: true
default: ''
runs:
using: 'node20'
main: 'deployment-action.js'
16 changes: 16 additions & 0 deletions .github/actions/deployment-action/deployment-action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
var core = require("@actions/core");
var github = require("@actions/github");
try {
var ref = (_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a["head"]["ref"];
console.log(ref);
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);
}
22 changes: 22 additions & 0 deletions .github/actions/deployment-action/deployment-action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as core from "@actions/core";
import * as github from "@actions/github";

const allowed = {
branch: ["master"],
prefix: ["release/"],
};

try {
const ref = github.context.payload.pull_request?.["head"]["ref"] as string | null;
if (ref == null) {
throw new Error("The branch name has not been recognized.");
}

if (allowed.branch.includes(ref) == false && allowed.prefix.includes(ref) == false) {
const message = `Allowing deployment from branch='${allowed.branch.join(', ')}' or with prefix='${allowed.prefix.join(', ')}'.`;
core.setFailed(`'${ref}' branch can't be released. ${message}.`);
core.setOutput(`'${ref}' branch can't be released. ${message}.`, "forbidden");
}
} catch (error) {
core.setFailed(error.message);
}
1 change: 1 addition & 0 deletions .github/actions/deployment-action/node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

228 changes: 228 additions & 0 deletions .github/actions/deployment-action/node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e431b8c

Please sign in to comment.