Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90a40adfe5 | ||
|
|
d3e35b292a | ||
|
|
c97a39a35f | ||
|
|
9df954b37b | ||
|
|
dea6ee7419 | ||
|
|
2ca4395141 | ||
|
|
6546aa9608 | ||
|
|
a60eec20ec | ||
|
|
21536c05d5 | ||
|
|
3a443e3a0a | ||
|
|
c320668126 |
58
CHANGELOG.md
58
CHANGELOG.md
@@ -2,64 +2,6 @@
|
|||||||
|
|
||||||
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.
|
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.5](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4...v3.5.5) (2020-03-16)
|
|
||||||
|
|
||||||
|
|
||||||
### chore
|
|
||||||
|
|
||||||
* Add new task all ([01fdaf2](https://github.com/peaceiris/actions-gh-pages/commit/01fdaf2f0274401d2403c809b20c37fb7a8535a6))
|
|
||||||
|
|
||||||
### fix
|
|
||||||
|
|
||||||
* skip on fork if pull_request (#158) ([d6bd618](https://github.com/peaceiris/actions-gh-pages/commit/d6bd6182f264ce695613180743d42e377570bbf4)), closes [#158](https://github.com/peaceiris/actions-gh-pages/issues/158) [#157](https://github.com/peaceiris/actions-gh-pages/issues/157)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [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)
|
|
||||||
|
|
||||||
|
|
||||||
### test
|
|
||||||
|
|
||||||
* skipOnFork() ([6f9a5b7](https://github.com/peaceiris/actions-gh-pages/commit/6f9a5b7a66bbf855cadc34099fa6450c40eff4a2))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.5.4-3](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-2...v3.5.4-3) (2020-03-14)
|
|
||||||
|
|
||||||
|
|
||||||
### fix
|
|
||||||
|
|
||||||
* skip logic ([01976c9](https://github.com/peaceiris/actions-gh-pages/commit/01976c9d9b95b42997caa2a85c2d737eb75e852e))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.5.4-2](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-1...v3.5.4-2) (2020-03-14)
|
## [3.5.4-2](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-1...v3.5.4-2) (2020-03-14)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -21,7 +21,3 @@ test:
|
|||||||
.PHONY: commit
|
.PHONY: commit
|
||||||
commit:
|
commit:
|
||||||
$(DOCKER_RUN) git commit -m "$(msg)"
|
$(DOCKER_RUN) git commit -m "$(msg)"
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all:
|
|
||||||
$(DOCKER_RUN) npm run all
|
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import {
|
|||||||
getWorkDirName,
|
getWorkDirName,
|
||||||
createWorkDir,
|
createWorkDir,
|
||||||
addNoJekyll,
|
addNoJekyll,
|
||||||
addCNAME,
|
addCNAME
|
||||||
skipOnFork
|
|
||||||
} from '../src/utils';
|
} from '../src/utils';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -204,30 +203,3 @@ describe('addCNAME()', () => {
|
|||||||
fs.unlinkSync(filepath);
|
fs.unlinkSync(filepath);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('skipOnFork()', () => {
|
|
||||||
test('return false on upstream', async () => {
|
|
||||||
const test = await skipOnFork(false, 'token', '', '');
|
|
||||||
expect(test).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('return false on fork with github_token', async () => {
|
|
||||||
const test = await skipOnFork(true, 'token', '', '');
|
|
||||||
expect(test).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('return false on fork with deploy_key', async () => {
|
|
||||||
const test = await skipOnFork(true, '', 'deploy_key', '');
|
|
||||||
expect(test).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('return false on fork with personal_token', async () => {
|
|
||||||
const test = await skipOnFork(true, '', '', 'personal_token');
|
|
||||||
expect(test).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('return true on fork with no tokens', async () => {
|
|
||||||
const test = await skipOnFork(true, '', '', '');
|
|
||||||
expect(test).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
1407
lib/index.js
1407
lib/index.js
File diff suppressed because it is too large
Load Diff
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "actions-github-pages",
|
"name": "actions-github-pages",
|
||||||
"version": "3.5.5",
|
"version": "3.5.4-2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "actions-github-pages",
|
"name": "actions-github-pages",
|
||||||
"version": "3.5.5",
|
"version": "3.5.4-2",
|
||||||
"description": "GitHub Actions for GitHub Pages",
|
"description": "GitHub Actions for GitHub Pages",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
"npm": ">=6.14.2"
|
"npm": ">=6.14.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"all": "npm run format && npm run lint && npm test",
|
|
||||||
"lint": "eslint ./{src,__tests__}/**/*.ts",
|
"lint": "eslint ./{src,__tests__}/**/*.ts",
|
||||||
"lint:fix": "eslint --fix ./{src,__tests__}/**/*.ts",
|
"lint:fix": "eslint --fix ./{src,__tests__}/**/*.ts",
|
||||||
"test": "jest --coverage --verbose --detectOpenHandles",
|
"test": "jest --coverage --verbose --detectOpenHandles",
|
||||||
|
|||||||
24
src/main.ts
24
src/main.ts
@@ -1,4 +1,3 @@
|
|||||||
import {context} from '@actions/github';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import {Inputs} from './interfaces';
|
import {Inputs} from './interfaces';
|
||||||
@@ -12,22 +11,13 @@ export async function run(): Promise<void> {
|
|||||||
const inps: Inputs = getInputs();
|
const inps: Inputs = getInputs();
|
||||||
showInputs(inps);
|
showInputs(inps);
|
||||||
|
|
||||||
const eventName = context.eventName;
|
const isSkipOnFork = await skipOnFork(
|
||||||
if (eventName === 'pull_request') {
|
inps.GithubToken,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
inps.DeployKey,
|
||||||
const isForkRepository = (context.payload as any).repository.fork;
|
inps.PersonalToken
|
||||||
const isSkipOnFork = await skipOnFork(
|
);
|
||||||
isForkRepository,
|
if (isSkipOnFork) {
|
||||||
inps.GithubToken,
|
return;
|
||||||
inps.DeployKey,
|
|
||||||
inps.PersonalToken
|
|
||||||
);
|
|
||||||
if (isSkipOnFork) {
|
|
||||||
core.warning(
|
|
||||||
'This action runs on a fork and not found auth token, Skip deployment'
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const remoteURL = await setTokens(inps);
|
const remoteURL = await setTokens(inps);
|
||||||
|
|||||||
18
src/utils.ts
18
src/utils.ts
@@ -1,3 +1,4 @@
|
|||||||
|
import {context} from '@actions/github';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
@@ -64,15 +65,22 @@ export async function addCNAME(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function skipOnFork(
|
export async function skipOnFork(
|
||||||
isForkRepository: boolean,
|
|
||||||
githubToken: string,
|
githubToken: string,
|
||||||
deployKey: string,
|
deployKey: string,
|
||||||
personalToken: string
|
personalToken: string
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
if (isForkRepository) {
|
const isForkRepository =
|
||||||
if (githubToken === '' && deployKey === '' && personalToken === '') {
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
return true;
|
(context.payload as any).repository.fork === 'true';
|
||||||
}
|
|
||||||
|
if (isForkRepository && deployKey === '') {
|
||||||
|
core.warning('Action runs on fork and deploy_key is empty');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isForkRepository && personalToken === '') {
|
||||||
|
core.warning('Action runs on fork and personalToken is empty');
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user