mirror of
https://github.com/peaceiris/actions-gh-pages.git
synced 2025-07-21 01:53:16 +08:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
90a40adfe5 | ||
|
d3e35b292a | ||
|
c97a39a35f | ||
|
9df954b37b | ||
|
dea6ee7419 | ||
|
2ca4395141 | ||
|
6546aa9608 | ||
|
a60eec20ec | ||
|
21536c05d5 | ||
|
3a443e3a0a | ||
|
c320668126 |
27
CHANGELOG.md
27
CHANGELOG.md
@ -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-2](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-1...v3.5.4-2) (2020-03-14)
|
||||
|
||||
|
||||
### fix
|
||||
|
||||
* skip logic ([c97a39a](https://github.com/peaceiris/actions-gh-pages/commit/c97a39a35f681badbf7490c2786eddf06b17316d))
|
||||
|
||||
|
||||
|
||||
## [3.5.4-1](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-0...v3.5.4-1) (2020-03-14)
|
||||
|
||||
|
||||
### fix
|
||||
|
||||
* isForkRepository ([6546aa9](https://github.com/peaceiris/actions-gh-pages/commit/6546aa96085e89bd91adc56f58be665766e93a1e))
|
||||
|
||||
|
||||
|
||||
## [3.5.4-0](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.3...v3.5.4-0) (2020-03-14)
|
||||
|
||||
|
||||
### fix
|
||||
|
||||
* skip on forks ([c320668](https://github.com/peaceiris/actions-gh-pages/commit/c320668126b104ad2c15ea1b583a75cd3978c2f3)), closes [#153](https://github.com/peaceiris/actions-gh-pages/issues/153)
|
||||
|
||||
|
||||
|
||||
## [3.5.3](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.2...v3.5.3) (2020-03-13)
|
||||
|
||||
|
||||
|
26963
lib/index.js
Normal file
26963
lib/index.js
Normal file
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",
|
||||
"version": "3.5.3",
|
||||
"version": "3.5.4-2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "actions-github-pages",
|
||||
"version": "3.5.3",
|
||||
"version": "3.5.4-2",
|
||||
"description": "GitHub Actions for GitHub Pages",
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
|
11
src/main.ts
11
src/main.ts
@ -4,13 +4,22 @@ import {Inputs} from './interfaces';
|
||||
import {showInputs, getInputs} from './get-inputs';
|
||||
import {setTokens} from './set-tokens';
|
||||
import {setRepo, setCommitAuthor, commit, push, pushTag} from './git-utils';
|
||||
import {getWorkDirName, addNoJekyll, addCNAME} from './utils';
|
||||
import {getWorkDirName, addNoJekyll, addCNAME, skipOnFork} from './utils';
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
const inps: Inputs = getInputs();
|
||||
showInputs(inps);
|
||||
|
||||
const isSkipOnFork = await skipOnFork(
|
||||
inps.GithubToken,
|
||||
inps.DeployKey,
|
||||
inps.PersonalToken
|
||||
);
|
||||
if (isSkipOnFork) {
|
||||
return;
|
||||
}
|
||||
|
||||
const remoteURL = await setTokens(inps);
|
||||
core.debug(`[INFO] remoteURL: ${remoteURL}`);
|
||||
|
||||
|
23
src/utils.ts
23
src/utils.ts
@ -1,3 +1,4 @@
|
||||
import {context} from '@actions/github';
|
||||
import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
import path from 'path';
|
||||
@ -62,3 +63,25 @@ export async function addCNAME(
|
||||
fs.writeFileSync(filepath, content + '\n');
|
||||
core.info(`[INFO] Created ${filepath}`);
|
||||
}
|
||||
|
||||
export async function skipOnFork(
|
||||
githubToken: string,
|
||||
deployKey: string,
|
||||
personalToken: string
|
||||
): Promise<boolean> {
|
||||
const isForkRepository =
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user