Compare commits

..

23 Commits

Author SHA1 Message Date
peaceiris
ee834289d5 chore(release): 3.5.4-5
Some checks failed
Release / release (push) Has been cancelled
2020-03-15 07:09:30 +09:00
peaceiris
a9077f3fa3 chore(release): Add build assets 2020-03-15 07:09:29 +09:00
peaceiris
72f58a06cf fix: property access 2020-03-14 22:09:05 +00:00
peaceiris
a8a9c90a27 chore(release): Remove build assets [skip ci] 2020-03-15 06:31:25 +09:00
peaceiris
ee6484961d chore(release): 3.5.4-4
Some checks failed
Release / release (push) Has been cancelled
2020-03-15 06:31:25 +09:00
peaceiris
a8f525053d chore(release): Add build assets 2020-03-15 06:31:24 +09:00
peaceiris
6f9a5b7a66 test: skipOnFork() 2020-03-14 21:31:02 +00:00
peaceiris
5c097c0f86 chore(release): Remove build assets [skip ci] 2020-03-15 06:13:31 +09:00
peaceiris
0f6166f02c chore(release): 3.5.4-3
Some checks failed
Release / release (push) Has been cancelled
2020-03-15 06:13:31 +09:00
peaceiris
2712ed55b1 chore(release): Add build assets 2020-03-15 06:13:30 +09:00
peaceiris
01976c9d9b fix: skip logic 2020-03-14 21:13:09 +00:00
peaceiris
78a39ce0df chore(release): Remove build assets [skip ci] 2020-03-15 06:03:00 +09:00
peaceiris
90a40adfe5 chore(release): 3.5.4-2
Some checks failed
Release / release (push) Has been cancelled
2020-03-15 06:03:00 +09:00
peaceiris
d3e35b292a chore(release): Add build assets 2020-03-15 06:02:59 +09:00
peaceiris
c97a39a35f fix: skip logic 2020-03-14 21:02:35 +00:00
peaceiris
9df954b37b chore(release): Remove build assets [skip ci] 2020-03-15 05:51:59 +09:00
peaceiris
dea6ee7419 chore(release): 3.5.4-1
Some checks failed
Release / release (push) Has been cancelled
2020-03-15 05:51:59 +09:00
peaceiris
2ca4395141 chore(release): Add build assets 2020-03-15 05:51:58 +09:00
peaceiris
6546aa9608 fix: isForkRepository 2020-03-14 20:51:26 +00:00
peaceiris
a60eec20ec chore(release): Remove build assets [skip ci] 2020-03-15 05:47:00 +09:00
peaceiris
21536c05d5 chore(release): 3.5.4-0
Some checks failed
Release / release (push) Has been cancelled
2020-03-15 05:46:59 +09:00
peaceiris
3a443e3a0a chore(release): Add build assets 2020-03-15 05:46:59 +09:00
peaceiris
c320668126 fix: skip on forks
Close #153
2020-03-14 20:45:50 +00:00
8 changed files with 29 additions and 64 deletions

View File

@@ -2,37 +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.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)

View File

@@ -21,7 +21,3 @@ test:
.PHONY: commit
commit:
$(DOCKER_RUN) git commit -m "$(msg)"
.PHONY: all
all:
$(DOCKER_RUN) npm run all

View File

@@ -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();
});

View File

@@ -1766,14 +1766,11 @@ function run() {
try {
const inps = get_inputs_1.getInputs();
get_inputs_1.showInputs(inps);
const eventName = github_1.context.eventName;
if (eventName === 'pull_request') {
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;
const isSkipOnFork = yield utils_1.skipOnFork(isForkRepository, inps.GithubToken, inps.DeployKey, inps.PersonalToken);
if (isSkipOnFork) {
core.warning('Action runs on fork and deploy_key or personal_token is empty, Skip deployment');
return;
}
const remoteURL = yield set_tokens_1.setTokens(inps);
core.debug(`[INFO] remoteURL: ${remoteURL}`);
@@ -2275,7 +2272,10 @@ 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 === '') {
return true;
}
}

2
package-lock.json generated
View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.5.5",
"version": "3.5.4-5",
"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",

View File

@@ -12,22 +12,19 @@ export async function run(): Promise<void> {
const inps: Inputs = getInputs();
showInputs(inps);
const eventName = context.eventName;
if (eventName === 'pull_request') {
// 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
// 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(
'Action runs on fork and deploy_key or personal_token is empty, Skip deployment'
);
if (isSkipOnFork) {
core.warning(
'This action runs on a fork and not found auth token, Skip deployment'
);
return;
}
return;
}
const remoteURL = await setTokens(inps);

View File

@@ -70,7 +70,11 @@ export async function skipOnFork(
personalToken: string
): Promise<boolean> {
if (isForkRepository) {
if (githubToken === '' && deployKey === '' && personalToken === '') {
if (githubToken) {
return false;
}
if (deployKey === '' && personalToken === '') {
return true;
}
}