Pusher is undefined in scheduled jobs (#62)

* Fallback for name and email

* Build
This commit is contained in:
James Ives 2019-11-22 10:01:06 -05:00 committed by GitHub
parent 1c579cbd85
commit c4cfbc80af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 8 deletions

View File

@ -24,8 +24,16 @@ exports.action = {
accessToken: core.getInput("ACCESS_TOKEN"), accessToken: core.getInput("ACCESS_TOKEN"),
branch: core.getInput("BRANCH"), branch: core.getInput("BRANCH"),
baseBranch: core.getInput("BASE_BRANCH") || "master", baseBranch: core.getInput("BASE_BRANCH") || "master",
clean: core.getInput("CLEAN"), name: pusher && pusher.name
pusher ? pusher.name
: process.env.GITHUB_ACTOR
? process.env.GITHUB_ACTOR
: "GitHub Pages Deploy Action",
email: pusher && pusher.email
? pusher.email
: `${process.env.GITHUB_ACTOR ||
"github-pages-deploy-action"}@users.noreply.github.com`,
clean: core.getInput("CLEAN")
}; };
// Repository path used for commits/pushes. // Repository path used for commits/pushes.
exports.repositoryPath = `https://${exports.action.accessToken || exports.repositoryPath = `https://${exports.action.accessToken ||

View File

@ -32,8 +32,8 @@ function init() {
return core.setFailed(`The deployment folder cannot be prefixed with '/' or './'. Instead reference the folder name directly.`); return core.setFailed(`The deployment folder cannot be prefixed with '/' or './'. Instead reference the folder name directly.`);
} }
yield util_1.execute(`git init`, constants_1.workspace); yield util_1.execute(`git init`, constants_1.workspace);
yield util_1.execute(`git config user.name ${constants_1.action.pusher.name}`, constants_1.workspace); yield util_1.execute(`git config user.name ${constants_1.action.name}`, constants_1.workspace);
yield util_1.execute(`git config user.email ${constants_1.action.pusher.email}`, constants_1.workspace); yield util_1.execute(`git config user.email ${constants_1.action.email}`, constants_1.workspace);
} }
catch (error) { catch (error) {
core.setFailed(`There was an error initializing the repository: ${error}`); core.setFailed(`There was an error initializing the repository: ${error}`);

View File

@ -19,8 +19,18 @@ export const action = {
accessToken: core.getInput("ACCESS_TOKEN"), accessToken: core.getInput("ACCESS_TOKEN"),
branch: core.getInput("BRANCH"), branch: core.getInput("BRANCH"),
baseBranch: core.getInput("BASE_BRANCH") || "master", baseBranch: core.getInput("BASE_BRANCH") || "master",
clean: core.getInput("CLEAN"), name:
pusher pusher && pusher.name
? pusher.name
: process.env.GITHUB_ACTOR
? process.env.GITHUB_ACTOR
: "GitHub Pages Deploy Action",
email:
pusher && pusher.email
? pusher.email
: `${process.env.GITHUB_ACTOR ||
"github-pages-deploy-action"}@users.noreply.github.com`,
clean: core.getInput("CLEAN")
}; };
// Repository path used for commits/pushes. // Repository path used for commits/pushes.

View File

@ -20,8 +20,8 @@ export async function init(): Promise<any> {
} }
await execute(`git init`, workspace); await execute(`git init`, workspace);
await execute(`git config user.name ${action.pusher.name}`, workspace); await execute(`git config user.name ${action.name}`, workspace);
await execute(`git config user.email ${action.pusher.email}`, workspace); await execute(`git config user.email ${action.email}`, workspace);
} catch (error) { } catch (error) {
core.setFailed(`There was an error initializing the repository: ${error}`); core.setFailed(`There was an error initializing the repository: ${error}`);
} finally { } finally {