Merge branch 'dev' into releases/v3

This commit is contained in:
JamesIves 2020-03-02 08:38:12 -05:00
commit eec2c1334b
7 changed files with 33 additions and 32 deletions

View File

@ -66,10 +66,11 @@ Calling the functions directly will require you to pass in an object containing
import run from "github-pages-deploy-action";
run({
folder: "build",
accessToken: process.env["ACCESS_TOKEN"],
branch: "gh-pages",
folder: "build",
repositoryName: "JamesIves/github-pages-deploy-action",
workspace: "src/project/location",
accessToken: process.env["ACCESS_TOKEN"]
});
```
@ -102,7 +103,7 @@ In addition to the deployment options you must also configure the following.
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| `GIT_CONFIG_NAME` | Allows you to customize the name that is attached to the GitHub config which is used when pushing the deployment commits. If this is not included it will use the name in the GitHub context, followed by the name of the action. | `with` | **No** |
| `GIT_CONFIG_EMAIL` | Allows you to customize the email that is attached to the GitHub config which is used when pushing the deployment commits. If this is not included it will use the email in the GitHub context, followed by a generic noreply GitHub email. | `with` | **No** |
| `REPOSITORY_PATH` | Allows you to speicfy a different repository path so long as you have permissions to push to it. This shoul be formatted like so: `JamesIves/github-pages-deploy-action`. | `with` | **No** |
| `REPOSITORY_NAME` | Allows you to speicfy a different repository path so long as you have permissions to push to it. This should be formatted like so: `JamesIves/github-pages-deploy-action`. | `with` | **No** |
| `TARGET_FOLDER` | If you'd like to push the contents of the deployment folder into a specific directory on the deployment branch you can specify it here. | `with` | **No** |
| `BASE_BRANCH` | The base branch of your repository which you'd like to checkout prior to deploying. This defaults to the current commit [SHA](http://en.wikipedia.org/wiki/SHA-1) that triggered the build followed by `master` if it doesn't exist. This is useful for making deployments from another branch, and also may be necessary when using a scheduled job. | `with` | **No** |
| `COMMIT_MESSAGE` | If you need to customize the commit message for an integration you can do so. | `with` | **No** |

View File

@ -80,7 +80,7 @@ describe("util", () => {
describe("generateRepositoryPath", () => {
it("should return ssh if ssh is provided", async () => {
const action = {
gitHubRepository: "JamesIves/github-pages-deploy-action",
repositoryName: "JamesIves/github-pages-deploy-action",
branch: "123",
root: ".",
workspace: "src/",
@ -96,7 +96,7 @@ describe("util", () => {
it("should return https if access token is provided", async () => {
const action = {
gitHubRepository: "JamesIves/github-pages-deploy-action",
repositoryName: "JamesIves/github-pages-deploy-action",
branch: "123",
root: ".",
workspace: "src/",
@ -112,7 +112,7 @@ describe("util", () => {
it("should return https with x-access-token if github token is provided", async () => {
const action = {
gitHubRepository: "JamesIves/github-pages-deploy-action",
repositoryName: "JamesIves/github-pages-deploy-action",
branch: "123",
root: ".",
workspace: "src/",
@ -129,7 +129,7 @@ describe("util", () => {
describe("suppressSensitiveInformation", () => {
it("should replace any sensitive information with ***", async () => {
const action = {
gitHubRepository: "JamesIves/github-pages-deploy-action",
repositoryName: "JamesIves/github-pages-deploy-action",
repositoryPath:
"https://x-access-token:supersecret999%%%@github.com/anothersecret123333",
branch: "123",
@ -148,7 +148,7 @@ describe("util", () => {
it("should not suppress information when in debug mode", async () => {
const action = {
gitHubRepository: "JamesIves/github-pages-deploy-action",
repositoryName: "JamesIves/github-pages-deploy-action",
repositoryPath:
"https://x-access-token:supersecret999%%%@github.com/anothersecret123333",
branch: "123",

6
lib/constants.d.ts vendored
View File

@ -19,15 +19,15 @@ export interface actionInterface {
email?: string;
/** The folder to deploy. */
folder: string;
/** The repository path, for example JamesIves/github-pages-deploy-action */
gitHubRepository?: string;
/** GitHub deployment token. */
gitHubToken?: string | null;
/** Determines if the action is running in test mode or not. */
isTest?: string | undefined | null;
/** The git config name. */
name?: string;
/** The fully qualified repositpory path, this gets auto generated if gitHubRepository is provided. */
/** The repository path, for example JamesIves/github-pages-deploy-action */
repositoryName?: string;
/** The fully qualified repositpory path, this gets auto generated if repositoryName is provided. */
repositoryPath?: string;
/** The root directory where your project lives. */
root?: string;

View File

@ -30,11 +30,6 @@ exports.action = {
? pusher.email
: `${process.env.GITHUB_ACTOR ||
"github-pages-deploy-action"}@users.noreply.github.com`,
gitHubRepository: !util_1.isNullOrUndefined(core_1.getInput("REPOSITORY_PATH"))
? core_1.getInput("REPOSITORY_PATH")
: repository && repository.full_name
? repository.full_name
: process.env.GITHUB_REPOSITORY,
gitHubToken: core_1.getInput("GITHUB_TOKEN"),
name: !util_1.isNullOrUndefined(core_1.getInput("GIT_CONFIG_NAME"))
? core_1.getInput("GIT_CONFIG_NAME")
@ -43,7 +38,12 @@ exports.action = {
: process.env.GITHUB_ACTOR
? process.env.GITHUB_ACTOR
: "GitHub Pages Deploy Action",
repositoryName: !util_1.isNullOrUndefined(core_1.getInput("REPOSITORY_NAME"))
? core_1.getInput("REPOSITORY_NAME")
: repository && repository.full_name
? repository.full_name
: process.env.GITHUB_REPOSITORY,
root: ".",
targetFolder: core_1.getInput("TARGET_FOLDER"),
workspace: process.env.GITHUB_WORKSPACE || "",
root: "."
workspace: process.env.GITHUB_WORKSPACE || ""
};

View File

@ -13,9 +13,9 @@ exports.generateTokenType = (action) => action.ssh
: "...";
/* Generates a the repository path used to make the commits. */
exports.generateRepositoryPath = (action) => action.ssh
? `git@github.com:${action.gitHubRepository}`
? `git@github.com:${action.repositoryName}`
: `https://${action.accessToken ||
`x-access-token:${action.gitHubToken}`}@github.com/${action.gitHubRepository}.git`;
`x-access-token:${action.gitHubToken}`}@github.com/${action.repositoryName}.git`;
/* Checks for the required tokens and formatting. Throws an error if any case is matched. */
exports.hasRequiredParameters = (action) => {
if ((exports.isNullOrUndefined(action.accessToken) &&

View File

@ -26,15 +26,15 @@ export interface actionInterface {
email?: string;
/** The folder to deploy. */
folder: string;
/** The repository path, for example JamesIves/github-pages-deploy-action */
gitHubRepository?: string;
/** GitHub deployment token. */
gitHubToken?: string | null;
/** Determines if the action is running in test mode or not. */
isTest?: string | undefined | null;
/** The git config name. */
name?: string;
/** The fully qualified repositpory path, this gets auto generated if gitHubRepository is provided. */
/** The repository path, for example JamesIves/github-pages-deploy-action */
repositoryName?: string;
/** The fully qualified repositpory path, this gets auto generated if repositoryName is provided. */
repositoryPath?: string;
/** The root directory where your project lives. */
root?: string;
@ -67,11 +67,6 @@ export const action: actionInterface = {
? pusher.email
: `${process.env.GITHUB_ACTOR ||
"github-pages-deploy-action"}@users.noreply.github.com`,
gitHubRepository: !isNullOrUndefined(getInput("REPOSITORY_PATH"))
? getInput("REPOSITORY_PATH")
: repository && repository.full_name
? repository.full_name
: process.env.GITHUB_REPOSITORY,
gitHubToken: getInput("GITHUB_TOKEN"),
name: !isNullOrUndefined(getInput("GIT_CONFIG_NAME"))
? getInput("GIT_CONFIG_NAME")
@ -80,7 +75,12 @@ export const action: actionInterface = {
: process.env.GITHUB_ACTOR
? process.env.GITHUB_ACTOR
: "GitHub Pages Deploy Action",
repositoryName: !isNullOrUndefined(getInput("REPOSITORY_NAME"))
? getInput("REPOSITORY_NAME")
: repository && repository.full_name
? repository.full_name
: process.env.GITHUB_REPOSITORY,
root: ".",
targetFolder: getInput("TARGET_FOLDER"),
workspace: process.env.GITHUB_WORKSPACE || "",
root: "."
workspace: process.env.GITHUB_WORKSPACE || ""
};

View File

@ -18,10 +18,10 @@ export const generateTokenType = (action: actionInterface): string =>
/* Generates a the repository path used to make the commits. */
export const generateRepositoryPath = (action: actionInterface): string =>
action.ssh
? `git@github.com:${action.gitHubRepository}`
? `git@github.com:${action.repositoryName}`
: `https://${action.accessToken ||
`x-access-token:${action.gitHubToken}`}@github.com/${
action.gitHubRepository
action.repositoryName
}.git`;
/* Checks for the required tokens and formatting. Throws an error if any case is matched. */