Adds git config options. (#154)

* Adds git config options.

* Compile
This commit is contained in:
James Ives 2020-01-27 23:55:28 -05:00 committed by GitHub
parent 89b4c6de5f
commit 2af9604f13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 21 deletions

View File

@ -24,6 +24,8 @@ jobs:
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma TARGET_FOLDER: montezuma
GIT_CONFIG_NAME: Montezuma
GIT_CONFIG_EMAIL: montezuma@jamesiv.es
# Deploys using checkout@v2 with a GITHUB_TOKEN. # Deploys using checkout@v2 with a GITHUB_TOKEN.
integration-checkout-v2: integration-checkout-v2:

View File

@ -23,6 +23,8 @@ jobs:
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma TARGET_FOLDER: montezuma
GIT_CONFIG_NAME: Montezuma
GIT_CONFIG_EMAIL: montezuma@jamesiv.es
# Deploys using checkout@v2 with a GITHUB_TOKEN. # Deploys using checkout@v2 with a GITHUB_TOKEN.
integration-checkout-v2: integration-checkout-v2:
@ -31,6 +33,8 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
persist-credentials: false
- name: Build and Deploy - name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3 uses: JamesIves/github-pages-deploy-action@releases/v3

View File

@ -65,6 +65,8 @@ In addition to the deployment options you must also configure the following.
| Key | Value Information | Type | Required | | Key | Value Information | Type | Required |
| ------------- | ------------- | ------------- | ------------- | | ------------- | ------------- | ------------- | ------------- |
| `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** |
| `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** | | `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** | | `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** | | `COMMIT_MESSAGE` | If you need to customize the commit message for an integration you can do so. | `with` | **No** |

View File

@ -47,3 +47,11 @@ inputs:
CLEAN_EXCLUDE: CLEAN_EXCLUDE:
description: "If you need to use CLEAN but you would like to preserve certain files or folders you can use this option. This should be formatted as an array but stored as a string." description: "If you need to use CLEAN but you would like to preserve certain files or folders you can use this option. This should be formatted as an array but stored as a string."
required: false required: false
GIT_CONFIG_NAME:
description: "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."
required: false
GIT_CONFIG_EMAIL:
description: "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."
required: false

View File

@ -9,6 +9,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@actions/core"); const core_1 = require("@actions/core");
const github = __importStar(require("@actions/github")); const github = __importStar(require("@actions/github"));
const util_1 = require("./util");
const { pusher, repository } = github.context.payload; const { pusher, repository } = github.context.payload;
exports.workspace = process.env.GITHUB_WORKSPACE; exports.workspace = process.env.GITHUB_WORKSPACE;
exports.folder = core_1.getInput("FOLDER", { required: true }); exports.folder = core_1.getInput("FOLDER", { required: true });
@ -25,7 +26,9 @@ exports.action = {
defaultBranch: process.env.GITHUB_SHA ? process.env.GITHUB_SHA : "master", defaultBranch: process.env.GITHUB_SHA ? process.env.GITHUB_SHA : "master",
isTest: process.env.UNIT_TEST, isTest: process.env.UNIT_TEST,
ssh: core_1.getInput("SSH"), ssh: core_1.getInput("SSH"),
email: pusher && pusher.email email: !util_1.isNullOrUndefined(core_1.getInput("GIT_CONFIG_EMAIL"))
? core_1.getInput("GIT_CONFIG_EMAIL")
: pusher && pusher.email
? pusher.email ? pusher.email
: `${process.env.GITHUB_ACTOR || : `${process.env.GITHUB_ACTOR ||
"github-pages-deploy-action"}@users.noreply.github.com`, "github-pages-deploy-action"}@users.noreply.github.com`,
@ -33,7 +36,9 @@ exports.action = {
? repository.full_name ? repository.full_name
: process.env.GITHUB_REPOSITORY, : process.env.GITHUB_REPOSITORY,
gitHubToken: core_1.getInput("GITHUB_TOKEN"), gitHubToken: core_1.getInput("GITHUB_TOKEN"),
name: pusher && pusher.name name: !util_1.isNullOrUndefined(core_1.getInput("GIT_CONFIG_NAME"))
? core_1.getInput("GIT_CONFIG_NAME")
: pusher && pusher.name
? pusher.name ? pusher.name
: process.env.GITHUB_ACTOR : process.env.GITHUB_ACTOR
? process.env.GITHUB_ACTOR ? process.env.GITHUB_ACTOR

View File

@ -1,5 +1,6 @@
import { getInput } from "@actions/core"; import { getInput } from "@actions/core";
import * as github from "@actions/github"; import * as github from "@actions/github";
import { isNullOrUndefined } from "./util";
const { pusher, repository } = github.context.payload; const { pusher, repository } = github.context.payload;
@ -19,8 +20,9 @@ export const action = {
defaultBranch: process.env.GITHUB_SHA ? process.env.GITHUB_SHA : "master", defaultBranch: process.env.GITHUB_SHA ? process.env.GITHUB_SHA : "master",
isTest: process.env.UNIT_TEST, isTest: process.env.UNIT_TEST,
ssh: getInput("SSH"), ssh: getInput("SSH"),
email: email: !isNullOrUndefined(getInput("GIT_CONFIG_EMAIL"))
pusher && pusher.email ? getInput("GIT_CONFIG_EMAIL")
: pusher && pusher.email
? pusher.email ? pusher.email
: `${process.env.GITHUB_ACTOR || : `${process.env.GITHUB_ACTOR ||
"github-pages-deploy-action"}@users.noreply.github.com`, "github-pages-deploy-action"}@users.noreply.github.com`,
@ -29,8 +31,9 @@ export const action = {
? repository.full_name ? repository.full_name
: process.env.GITHUB_REPOSITORY, : process.env.GITHUB_REPOSITORY,
gitHubToken: getInput("GITHUB_TOKEN"), gitHubToken: getInput("GITHUB_TOKEN"),
name: name: !isNullOrUndefined(getInput("GIT_CONFIG_NAME"))
pusher && pusher.name ? getInput("GIT_CONFIG_NAME")
: pusher && pusher.name
? pusher.name ? pusher.name
: process.env.GITHUB_ACTOR : process.env.GITHUB_ACTOR
? process.env.GITHUB_ACTOR ? process.env.GITHUB_ACTOR

View File

@ -18,7 +18,7 @@
"no-implicit-dependencies": true, "no-implicit-dependencies": true,
"no-invalid-this": true, "no-invalid-this": true,
"no-string-throw": true, "no-string-throw": true,
"no-unsafe-finally": true, "no-unsafe-finally": false,
"no-use-before-declare": true, "no-use-before-declare": true,
"no-void-expression": [true, "ignore-arrow-function-shorthand"], "no-void-expression": [true, "ignore-arrow-function-shorthand"],
"no-duplicate-imports": true, "no-duplicate-imports": true,