Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee6484961d | ||
|
|
a8f525053d | ||
|
|
6f9a5b7a66 | ||
|
|
5c097c0f86 | ||
|
|
0f6166f02c | ||
|
|
2712ed55b1 | ||
|
|
01976c9d9b | ||
|
|
78a39ce0df | ||
|
|
90a40adfe5 | ||
|
|
d3e35b292a | ||
|
|
c97a39a35f | ||
|
|
9df954b37b | ||
|
|
dea6ee7419 | ||
|
|
2ca4395141 | ||
|
|
6546aa9608 | ||
|
|
a60eec20ec | ||
|
|
21536c05d5 | ||
|
|
3a443e3a0a | ||
|
|
c320668126 |
49
CHANGELOG.md
49
CHANGELOG.md
@@ -2,55 +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.
|
||||
|
||||
## [3.5.6](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.5...v3.5.6) (2020-03-16)
|
||||
|
||||
|
||||
### fix
|
||||
|
||||
* skip on fork (#159) ([6fa13fe](https://github.com/peaceiris/actions-gh-pages/commit/6fa13fefb393227eec5c9710d92e8bffa917546a)), closes [#159](https://github.com/peaceiris/actions-gh-pages/issues/159)
|
||||
|
||||
|
||||
|
||||
## [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)
|
||||
|
||||
|
||||
|
||||
4
Makefile
4
Makefile
@@ -21,7 +21,3 @@ test:
|
||||
.PHONY: commit
|
||||
commit:
|
||||
$(DOCKER_RUN) git commit -m "$(msg)"
|
||||
|
||||
.PHONY: all
|
||||
all:
|
||||
$(DOCKER_RUN) npm run all
|
||||
|
||||
@@ -226,7 +226,7 @@ describe('skipOnFork()', () => {
|
||||
expect(test).toBeFalsy();
|
||||
});
|
||||
|
||||
test('return true on fork with no tokens', async () => {
|
||||
test('return true on fork with empty deploy_key or personal_token', async () => {
|
||||
const test = await skipOnFork(true, '', '', '');
|
||||
expect(test).toBeTruthy();
|
||||
});
|
||||
|
||||
18
lib/index.js
18
lib/index.js
@@ -1766,14 +1766,10 @@ function run() {
|
||||
try {
|
||||
const inps = get_inputs_1.getInputs();
|
||||
get_inputs_1.showInputs(inps);
|
||||
const eventName = github_1.context.eventName;
|
||||
if (eventName === 'pull_request' || eventName === 'push') {
|
||||
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 isForkRepository = github_1.context.payload.repository.fork === 'true';
|
||||
const isSkipOnFork = yield utils_1.skipOnFork(isForkRepository, inps.GithubToken, inps.DeployKey, inps.PersonalToken);
|
||||
if (isSkipOnFork) {
|
||||
return;
|
||||
}
|
||||
const remoteURL = yield set_tokens_1.setTokens(inps);
|
||||
core.debug(`[INFO] remoteURL: ${remoteURL}`);
|
||||
@@ -2275,7 +2271,11 @@ exports.addCNAME = addCNAME;
|
||||
function skipOnFork(isForkRepository, githubToken, deployKey, personalToken) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (isForkRepository) {
|
||||
if (githubToken === '' && deployKey === '' && personalToken === '') {
|
||||
if (githubToken) {
|
||||
return false;
|
||||
}
|
||||
if (deployKey === '' && personalToken === '') {
|
||||
core.warning('Action runs on fork and deploy_key or personal_token is empty');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "actions-github-pages",
|
||||
"version": "3.5.6",
|
||||
"version": "3.5.4-4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "actions-github-pages",
|
||||
"version": "3.5.6",
|
||||
"version": "3.5.4-4",
|
||||
"description": "GitHub Actions for GitHub Pages",
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
@@ -8,7 +8,6 @@
|
||||
"npm": ">=6.14.2"
|
||||
},
|
||||
"scripts": {
|
||||
"all": "npm run format && npm run lint && npm test",
|
||||
"lint": "eslint ./{src,__tests__}/**/*.ts",
|
||||
"lint:fix": "eslint --fix ./{src,__tests__}/**/*.ts",
|
||||
"test": "jest --coverage --verbose --detectOpenHandles",
|
||||
|
||||
25
src/main.ts
25
src/main.ts
@@ -12,22 +12,17 @@ export async function run(): Promise<void> {
|
||||
const inps: Inputs = getInputs();
|
||||
showInputs(inps);
|
||||
|
||||
const eventName = context.eventName;
|
||||
if (eventName === 'pull_request' || eventName === 'push') {
|
||||
const isForkRepository =
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const isForkRepository = (context.payload as any).repository.fork;
|
||||
const isSkipOnFork = await 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;
|
||||
}
|
||||
(context.payload as any).repository.fork === 'true';
|
||||
const isSkipOnFork = await skipOnFork(
|
||||
isForkRepository,
|
||||
inps.GithubToken,
|
||||
inps.DeployKey,
|
||||
inps.PersonalToken
|
||||
);
|
||||
if (isSkipOnFork) {
|
||||
return;
|
||||
}
|
||||
|
||||
const remoteURL = await setTokens(inps);
|
||||
|
||||
@@ -70,7 +70,14 @@ export async function skipOnFork(
|
||||
personalToken: string
|
||||
): Promise<boolean> {
|
||||
if (isForkRepository) {
|
||||
if (githubToken === '' && deployKey === '' && personalToken === '') {
|
||||
if (githubToken) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (deployKey === '' && personalToken === '') {
|
||||
core.warning(
|
||||
'Action runs on fork and deploy_key or personal_token is empty'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user