Skip to content

Commit

Permalink
3.5.0 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed May 14, 2020
1 parent 530892a commit 5af4d9f
Show file tree
Hide file tree
Showing 3,341 changed files with 425,824 additions and 66,199 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 7 additions & 0 deletions lib/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ export interface ActionInterface {
workspace: string;
}
export declare const action: ActionInterface;
/** Status codes for the action. */
export declare enum Status {
SUCCESS = "success",
FAILED = "failed",
SKIPPED = "skipped",
RUNNING = "running"
}
25 changes: 23 additions & 2 deletions lib/constants.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Status = exports.action = void 0;
const core_1 = require("@actions/core");
const github = __importStar(require("@actions/github"));
const util_1 = require("./util");
Expand Down Expand Up @@ -54,3 +67,11 @@ exports.action = {
targetFolder: core_1.getInput('TARGET_FOLDER'),
workspace: process.env.GITHUB_WORKSPACE || ''
};
/** Status codes for the action. */
var Status;
(function (Status) {
Status["SUCCESS"] = "success";
Status["FAILED"] = "failed";
Status["SKIPPED"] = "skipped";
Status["RUNNING"] = "running";
})(Status = exports.Status || (exports.Status = {}));
1 change: 1 addition & 0 deletions lib/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.stdout = exports.execute = void 0;
const core_1 = require("@actions/core");
const exec_1 = require("@actions/exec");
let output;
Expand Down
4 changes: 2 additions & 2 deletions lib/git.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActionInterface } from './constants';
import { ActionInterface, Status } from './constants';
export declare function init(action: ActionInterface): Promise<void | Error>;
export declare function switchToBaseBranch(action: ActionInterface): Promise<void>;
export declare function generateBranch(action: ActionInterface): Promise<void>;
export declare function deploy(action: ActionInterface): Promise<void>;
export declare function deploy(action: ActionInterface): Promise<Status>;
6 changes: 4 additions & 2 deletions lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.deploy = exports.generateBranch = exports.switchToBaseBranch = exports.init = void 0;
const core_1 = require("@actions/core");
const io_1 = require("@actions/io");
const constants_1 = require("./constants");
const execute_1 = require("./execute");
const util_1 = require("./util");
/* Initializes git in the workspace. */
Expand Down Expand Up @@ -122,8 +124,7 @@ function deploy(action) {
: ''}`, action.workspace);
const hasFilesToCommit = yield execute_1.execute(`git status --porcelain`, `${action.workspace}/${temporaryDeploymentDirectory}`);
if (!hasFilesToCommit && !action.isTest) {
core_1.info('There is nothing to commit. Exiting early… 📭');
return;
return constants_1.Status.SKIPPED;
}
// Commits to GitHub.
yield execute_1.execute(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`);
Expand All @@ -143,6 +144,7 @@ function deploy(action) {
core_1.info('Cleared git history… 🚿');
}
yield execute_1.execute(`git checkout --progress --force ${action.defaultBranch}`, action.workspace);
return constants_1.Status.SUCCESS;
}
catch (error) {
throw new Error(`The deploy step encountered an error: ${util_1.suppressSensitiveInformation(error.message, action)} ❌`);
Expand Down
21 changes: 13 additions & 8 deletions lib/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateBranch = exports.deploy = exports.init = void 0;
const core_1 = require("@actions/core");
const constants_1 = require("./constants");
const git_1 = require("./git");
exports.deploy = git_1.deploy;
exports.generateBranch = git_1.generateBranch;
exports.init = git_1.init;
Object.defineProperty(exports, "deploy", { enumerable: true, get: function () { return git_1.deploy; } });
Object.defineProperty(exports, "generateBranch", { enumerable: true, get: function () { return git_1.generateBranch; } });
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return git_1.init; } });
const util_1 = require("./util");
/** Initializes and runs the action.
*
* @param {object} configuration - The action configuration.
*/
function run(configuration) {
return __awaiter(this, void 0, void 0, function* () {
let errorState = false;
let status = constants_1.Status.RUNNING;
try {
core_1.info('Checking configuration and starting deployment… 🚦');
const settings = Object.assign(Object.assign({}, constants_1.action), configuration);
// Defines the repository paths and token types.
settings.repositoryPath = util_1.generateRepositoryPath(settings);
settings.tokenType = util_1.generateTokenType(settings);
yield git_1.init(settings);
yield git_1.deploy(settings);
status = yield git_1.deploy(settings);
}
catch (error) {
errorState = true;
status = constants_1.Status.FAILED;
core_1.setFailed(error.message);
}
finally {
core_1.info(`${errorState
console.log(status);
core_1.info(`${status === constants_1.Status.FAILED
? 'Deployment Failed ❌'
: 'Completed Deployment Successfully! ✅'}`);
: status === constants_1.Status.SUCCESS
? 'Completed Deployment Successfully! ✅'
: 'There is nothing to commit. Exiting early… 📭'}`);
core_1.exportVariable('DEPLOYMENT_STATUS', status);
}
});
}
Expand Down
6 changes: 4 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.suppressSensitiveInformation = exports.hasRequiredParameters = exports.generateRepositoryPath = exports.generateTokenType = exports.isNullOrUndefined = void 0;
const core_1 = require("@actions/core");
/* Utility function that checks to see if a value is undefined or not. */
exports.isNullOrUndefined = (value) => typeof value === 'undefined' || value === null || value === '';
Expand All @@ -10,7 +11,7 @@ exports.generateTokenType = (action) => action.ssh
? 'Access Token'
: action.gitHubToken
? 'GitHub Token'
: '...';
: '';
/* Generates a the repository path used to make the commits. */
exports.generateRepositoryPath = (action) => action.ssh
? `[email protected]:${action.repositoryName}`
Expand All @@ -20,7 +21,8 @@ exports.hasRequiredParameters = (action) => {
if ((exports.isNullOrUndefined(action.accessToken) &&
exports.isNullOrUndefined(action.gitHubToken) &&
exports.isNullOrUndefined(action.ssh)) ||
exports.isNullOrUndefined(action.repositoryPath)) {
exports.isNullOrUndefined(action.repositoryPath) ||
(action.accessToken && action.accessToken === '')) {
throw new Error('No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true.');
}
if (exports.isNullOrUndefined(action.branch)) {
Expand Down
2 changes: 1 addition & 1 deletion node_modules/.bin/jest-runtime

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

2 changes: 1 addition & 1 deletion node_modules/.bin/which

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

9 changes: 7 additions & 2 deletions node_modules/@actions/core/lib/command.d.ts

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

18 changes: 16 additions & 2 deletions node_modules/@actions/core/lib/command.js

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

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/command.js.map

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

28 changes: 17 additions & 11 deletions node_modules/@actions/core/lib/core.d.ts

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

31 changes: 22 additions & 9 deletions node_modules/@actions/core/lib/core.js

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

Loading

0 comments on commit 5af4d9f

Please sign in to comment.