Compare commits

..

8 Commits

Author SHA1 Message Date
peaceiris
9d932c08b7 chore(release): 3.5.5
Some checks failed
Release / release (push) Has been cancelled
2020-03-16 11:49:22 +09:00
peaceiris
53c9fb0da1 chore(release): Add build assets 2020-03-16 11:49:22 +09:00
Shohei Ueda
d6bd6182f2 fix: skip on fork if pull_request (#158)
cf. #157
2020-03-16 11:48:40 +09:00
peaceiris
01fdaf2f02 chore: Add new task all 2020-03-16 00:43:59 +00:00
peaceiris
75c03d0413 chore(release): Remove build assets [skip ci] 2020-03-16 09:01:39 +09:00
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
8 changed files with 64 additions and 29 deletions

View File

@@ -2,6 +2,37 @@
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,3 +21,7 @@ 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 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,11 +1766,14 @@ function run() {
try {
const inps = get_inputs_1.getInputs();
get_inputs_1.showInputs(inps);
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 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 remoteURL = yield set_tokens_1.setTokens(inps);
core.debug(`[INFO] remoteURL: ${remoteURL}`);
@@ -2272,10 +2275,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 === '') {
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-5",
"version": "3.5.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.5.4-5",
"version": "3.5.5",
"description": "GitHub Actions for GitHub Pages",
"main": "lib/index.js",
"engines": {
@@ -8,6 +8,7 @@
"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,19 +12,22 @@ export async function run(): Promise<void> {
const inps: Inputs = getInputs();
showInputs(inps);
// 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'
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
);
return;
if (isSkipOnFork) {
core.warning(
'This action runs on a fork and not found auth token, Skip deployment'
);
return;
}
}
const remoteURL = await setTokens(inps);

View File

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