Compare commits

..

3 Commits

Author SHA1 Message Date
peaceiris
ade70d3851 chore(release): 3.5.4
Some checks failed
Release / release (push) Has been cancelled
2020-03-16 09:01:38 +09:00
peaceiris
abaaadb545 chore(release): Add build assets 2020-03-16 09:01:37 +09:00
Shohei Ueda
4f06df820b fix: skip deployment on forks (#156)
* fix: skip on forks
* chore(release): 3.5.4-6

Close #153
2020-03-16 09:00:19 +09:00
7 changed files with 39 additions and 20 deletions

View File

@@ -2,6 +2,33 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [3.5.4](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.3...v3.5.4) (2020-03-16)
### fix
* skip deployment on forks (#156) ([4f06df8](https://github.com/peaceiris/actions-gh-pages/commit/4f06df820b7a5882e2faef0e6929bb670140fba0)), closes [#156](https://github.com/peaceiris/actions-gh-pages/issues/156) [#153](https://github.com/peaceiris/actions-gh-pages/issues/153)
## [3.5.4-6](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-5...v3.5.4-6) (2020-03-15)
### fix
* skip logic ([44bdada](https://github.com/peaceiris/actions-gh-pages/commit/44bdada02c71f646d23ffefe1ea07d16386dbf83))
## [3.5.4-5](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-4...v3.5.4-5) (2020-03-14)
### fix
* property access ([72f58a0](https://github.com/peaceiris/actions-gh-pages/commit/72f58a06cf5db88d3eb982f57de8dbc266e39232))
## [3.5.4-4](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-3...v3.5.4-4) (2020-03-14)

View File

@@ -226,7 +226,7 @@ describe('skipOnFork()', () => {
expect(test).toBeFalsy();
});
test('return true on fork with empty deploy_key or personal_token', async () => {
test('return true on fork with no tokens', async () => {
const test = await skipOnFork(true, '', '', '');
expect(test).toBeTruthy();
});

View File

@@ -1766,9 +1766,10 @@ function run() {
try {
const inps = get_inputs_1.getInputs();
get_inputs_1.showInputs(inps);
const isForkRepository = github_1.context.payload.repository.fork === 'true';
const isForkRepository = github_1.context.payload.repository.fork;
const isSkipOnFork = yield utils_1.skipOnFork(isForkRepository, inps.GithubToken, inps.DeployKey, inps.PersonalToken);
if (isSkipOnFork) {
core.warning('This action runs on a fork and not found auth token, Skip deployment');
return;
}
const remoteURL = yield set_tokens_1.setTokens(inps);
@@ -2271,11 +2272,7 @@ exports.addCNAME = addCNAME;
function skipOnFork(isForkRepository, githubToken, deployKey, personalToken) {
return __awaiter(this, void 0, void 0, function* () {
if (isForkRepository) {
if (githubToken) {
return false;
}
if (deployKey === '' && personalToken === '') {
core.warning('Action runs on fork and deploy_key or personal_token is empty');
if (githubToken === '' && deployKey === '' && personalToken === '') {
return true;
}
}

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.5.4-4",
"version": "3.5.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.5.4-4",
"version": "3.5.4",
"description": "GitHub Actions for GitHub Pages",
"main": "lib/index.js",
"engines": {

View File

@@ -12,9 +12,8 @@ export async function run(): Promise<void> {
const inps: Inputs = getInputs();
showInputs(inps);
const isForkRepository =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(context.payload as any).repository.fork === 'true';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const isForkRepository = (context.payload as any).repository.fork;
const isSkipOnFork = await skipOnFork(
isForkRepository,
inps.GithubToken,
@@ -22,6 +21,9 @@ export async function run(): Promise<void> {
inps.PersonalToken
);
if (isSkipOnFork) {
core.warning(
'This action runs on a fork and not found auth token, Skip deployment'
);
return;
}

View File

@@ -70,14 +70,7 @@ export async function skipOnFork(
personalToken: string
): Promise<boolean> {
if (isForkRepository) {
if (githubToken) {
return false;
}
if (deployKey === '' && personalToken === '') {
core.warning(
'Action runs on fork and deploy_key or personal_token is empty'
);
if (githubToken === '' && deployKey === '' && personalToken === '') {
return true;
}
}