Compare commits

...

46 Commits

Author SHA1 Message Date
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
peaceiris
ff31e77830 chore(release): Remove build assets [skip ci] 2020-03-14 06:50:48 +09:00
peaceiris
81f05c5524 chore(release): 3.5.3
Some checks failed
Release / release (push) Has been cancelled
2020-03-14 06:50:47 +09:00
peaceiris
60edcea535 chore(release): Add build assets 2020-03-14 06:50:46 +09:00
dependabot-preview[bot]
2fa0a59e21 deps: [security] bump acorn from 6.4.0 to 6.4.1 (#155) 2020-03-13 21:49:04 +00:00
dependabot-preview[bot]
d1f987783c deps: bump @types/node from 12.12.29 to 12.12.30 (#154) 2020-03-13 19:13:12 +00:00
peaceiris
0466bfb243 chore(release): Remove build assets [skip ci] 2020-03-12 23:24:13 +09:00
peaceiris
a228296ccf chore(release): 3.5.2
Some checks failed
Release / release (push) Has been cancelled
2020-03-12 23:24:13 +09:00
peaceiris
77664235e1 chore(release): Add build assets 2020-03-12 23:24:12 +09:00
Shohei Ueda
a1ff787715 fix: set commit author as local config (#152)
* fix: set commit author as local config

Close #151

Co-authored-by: Ryo Ota <nwtgck@nwtgck.org>
2020-03-12 22:58:12 +09:00
Shohei Ueda
b2788ae3c6 chore: reindent 2020-03-12 09:24:30 +09:00
dependabot-preview[bot]
680198766b deps: bump @typescript-eslint/parser from 2.22.0 to 2.23.0 (#149) 2020-03-10 08:09:38 +00:00
dependabot-preview[bot]
7f32718f66 deps: bump @typescript-eslint/eslint-plugin from 2.22.0 to 2.23.0 (#150) 2020-03-10 07:28:32 +00:00
peaceiris
0404476337 chore(release): Remove build assets [skip ci] 2020-03-09 21:46:01 +09:00
peaceiris
221953c929 chore(release): 3.5.1
Some checks failed
Release / release (push) Has been cancelled
2020-03-09 21:46:00 +09:00
peaceiris
dd094624d6 chore(release): Add build assets 2020-03-09 21:45:59 +09:00
peaceiris
a7bc3c37fd chore: Add missing descriptions 2020-03-09 21:45:20 +09:00
Shohei Ueda
c279167199 ci: update script link [skip ci] 2020-03-09 20:23:58 +09:00
dependabot-preview[bot]
a4c25ca778 deps: bump @types/jest from 25.1.3 to 25.1.4 (#148) 2020-03-08 19:36:32 +00:00
Shohei Ueda
9571d29e0d docs: fix user_name 2020-03-08 15:36:36 +09:00
Shohei Ueda
f3b165fbe1 ci: fix user_name 2020-03-08 15:33:52 +09:00
Shohei Ueda
eb73e9cb9d docs: fix user_name 2020-03-08 15:33:14 +09:00
Shohei Ueda
860ed1944f docs: fix user_name 2020-03-08 15:31:05 +09:00
Shohei Ueda
945c44d50a ci: fix user_name 2020-03-08 15:27:46 +09:00
imgbot[bot]
d8ed36f54a chore: [ImgBot] Optimize images (#147)
/images/committer_github_actions_bot.jpg -- 15.70kb -> 13.58kb (13.46%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>

Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
2020-03-08 14:59:49 +09:00
peaceiris
d2d8e21d7e docs: Add bot committer image 2020-03-08 14:54:57 +09:00
Shohei Ueda
80c8fe5fb3 ci: Add GitHub Actions bot as committer 2020-03-08 14:42:09 +09:00
Shohei Ueda
81884efe7c docs: Add GitHub Actions bot committer 2020-03-08 14:39:04 +09:00
Shohei Ueda
618792b2f0 deps: bump hub 2.14.1 to 2.14.2 2020-03-07 19:32:13 +09:00
Shohei Ueda
86214f3d79 chore: Add user support issue template (#146)
* chore: Add user support issue template
* chore: Fix title
* chore: Add link to Actions Documentation

Close #58
2020-03-07 19:01:05 +09:00
Shohei Ueda
68520436f8 docs: Add notes about GitHub_TOKEN (#145)
* docs: Add notes about GitHub_TOKEN
* docs: Update images
2020-03-07 18:32:36 +09:00
peaceiris
fab0628782 chore(release): Remove build assets [skip ci] 2020-03-07 05:46:57 +09:00
25 changed files with 448 additions and 123 deletions

View File

@@ -1,7 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
title: 'Bug: This is a sample issue title'
title: 'sample_title'
labels: bug
assignees: peaceiris

View File

@@ -3,6 +3,9 @@ contact_links:
- name: GitHub Actions Community Forum
url: https://github.community/t5/GitHub-Actions/bd-p/actions
about: Please ask questions about GitHub Actions here.
- name: GitHub Pages help
- name: GitHub Pages Documentation
url: https://help.github.com/en/github/working-with-github-pages
about: GitHub Pages documentaion here.
about: GitHub Pages official documentaion here.
- name: GitHub Actions Documentation
url: https://help.github.com/en/actions
about: GitHub Actions official documentaion here.

View File

@@ -1,7 +1,7 @@
---
name: Proposal
about: Suggest an idea for this project
title: 'proposal: This is a sample title'
title: 'sample_title'
labels: proposal
assignees: peaceiris

31
.github/ISSUE_TEMPLATE/user_support.md vendored Normal file
View File

@@ -0,0 +1,31 @@
---
name: User support
about: Questions for this action
title: 'sample_title'
labels: support
assignees: peaceiris
---
**Check list before opening this issue**
- [ ] I read the latest README
- I checked [Available Options](https://github.com/peaceiris/actions-gh-pages#options)
- I followed [Tips and FAQ](https://github.com/peaceiris/actions-gh-pages#tips-and-faq)
- I tried [Workflow Examples](https://github.com/peaceiris/actions-gh-pages#examples)
**Describe your question**
A clear and concise description of what the question is.
**Link to your contents**
- Link to your public repository here
- Link to your workflow here
**Screenshots**
If applicable, add screenshots to help explain your question.
**Additional context**
Add any other context about the problem here.

View File

@@ -3,13 +3,12 @@ name: Release
on:
push:
tags:
- 'v3.*.*'
- 'v3.*.*'
jobs:
release:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Dump GitHub context
@@ -19,8 +18,8 @@ jobs:
- name: Install github/hub
run: |
export HUB_VERSION="2.14.1"
curl -fsSL https://github.com/github/hub/raw/40e421edd2c63d57bb8daa4bb9bbdfa21e8becf9/script/get | bash -s "${HUB_VERSION}"
export HUB_VERSION="2.14.2"
curl -fsSL https://github.com/github/hub/raw/8d91904208171b013f9a9d1175f4ab39068db047/script/get | bash -s "${HUB_VERSION}"
- name: Create release
env:

View File

@@ -2,16 +2,16 @@ name: "Stale"
on:
schedule:
- cron: "6 6 * * *"
- cron: "6 6 * * *"
jobs:
stale:
runs-on: ubuntu-18.04
steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
stale-pr-message: 'This pull request is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
days-before-stale: 21
days-before-close: 7
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
stale-pr-message: 'This pull request is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
days-before-stale: 21
days-before-close: 7

View File

@@ -87,8 +87,8 @@ jobs:
allow_empty_commit: true
# keep_files: true
# force_orphan: true
# user_name: iris
# user_email: email@peaceiris.com
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
# commit_message: ${{ github.event.head_commit.message }}
# tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
# tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'

View File

@@ -2,6 +2,102 @@
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-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)
### 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)
### deps
* [security] bump acorn from 6.4.0 to 6.4.1 (#155) ([2fa0a59](https://github.com/peaceiris/actions-gh-pages/commit/2fa0a59e21f19c0862ebc505187b3ede95a92561)), closes [#155](https://github.com/peaceiris/actions-gh-pages/issues/155)
* bump @types/node from 12.12.29 to 12.12.30 (#154) ([d1f9877](https://github.com/peaceiris/actions-gh-pages/commit/d1f987783c05614c72b8c5009fbfd941982128ec)), closes [#154](https://github.com/peaceiris/actions-gh-pages/issues/154)
## [3.5.2](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.1...v3.5.2) (2020-03-12)
### chore
* reindent ([b2788ae](https://github.com/peaceiris/actions-gh-pages/commit/b2788ae3c6c463fccde4f9db8abac12cf2f42b72))
### deps
* bump @typescript-eslint/eslint-plugin from 2.22.0 to 2.23.0 (#150) ([7f32718](https://github.com/peaceiris/actions-gh-pages/commit/7f32718f667956be6bab3cd2dffe9559cdd26fc7)), closes [#150](https://github.com/peaceiris/actions-gh-pages/issues/150)
* bump @typescript-eslint/parser from 2.22.0 to 2.23.0 (#149) ([6801987](https://github.com/peaceiris/actions-gh-pages/commit/680198766bcc7c4625ee5c9f599187f99bf0c118)), closes [#149](https://github.com/peaceiris/actions-gh-pages/issues/149)
### fix
* set commit author as local config (#152) ([a1ff787](https://github.com/peaceiris/actions-gh-pages/commit/a1ff787715905a17a17d1ab7b42eba976a4553c6)), closes [#152](https://github.com/peaceiris/actions-gh-pages/issues/152) [#151](https://github.com/peaceiris/actions-gh-pages/issues/151)
## [3.5.1](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.0...v3.5.1) (2020-03-09)
### chore
* [ImgBot] Optimize images (#147) ([d8ed36f](https://github.com/peaceiris/actions-gh-pages/commit/d8ed36f54aee9f59e2e00fa7aceda885cd6d3eb8)), closes [#147](https://github.com/peaceiris/actions-gh-pages/issues/147)
* Add missing descriptions ([a7bc3c3](https://github.com/peaceiris/actions-gh-pages/commit/a7bc3c37fdc9c640720165cb06fbffe20febe7a3))
* Add user support issue template (#146) ([86214f3](https://github.com/peaceiris/actions-gh-pages/commit/86214f3d7909e3e81e38f0a73a897e00fc1198e4)), closes [#146](https://github.com/peaceiris/actions-gh-pages/issues/146) [#58](https://github.com/peaceiris/actions-gh-pages/issues/58)
### ci
* Add GitHub Actions bot as committer ([80c8fe5](https://github.com/peaceiris/actions-gh-pages/commit/80c8fe5fb32cd1e1b866e2d0d0d34cb1ba492586))
* fix user_name ([f3b165f](https://github.com/peaceiris/actions-gh-pages/commit/f3b165fbe1a9ec4c9bd8b435ee13fc7cb10ef42a))
* fix user_name ([945c44d](https://github.com/peaceiris/actions-gh-pages/commit/945c44d50a26eb6b24dbc0157dd836a39f9d5edb))
* update script link [skip ci] ([c279167](https://github.com/peaceiris/actions-gh-pages/commit/c2791671998aa8f7858322a1bb74a1e74fb58923))
### deps
* bump @types/jest from 25.1.3 to 25.1.4 (#148) ([a4c25ca](https://github.com/peaceiris/actions-gh-pages/commit/a4c25ca7788f09428015b84ffd661ec30c7f2734)), closes [#148](https://github.com/peaceiris/actions-gh-pages/issues/148)
* bump hub 2.14.1 to 2.14.2 ([618792b](https://github.com/peaceiris/actions-gh-pages/commit/618792b2f09d6b33bc394ffa2ffaec5ce48fc15d))
### docs
* Add bot committer image ([d2d8e21](https://github.com/peaceiris/actions-gh-pages/commit/d2d8e21d7ee28e4ab68e977f54ce0de33f9ae3ba))
* Add GitHub Actions bot committer ([81884ef](https://github.com/peaceiris/actions-gh-pages/commit/81884efe7cbee81f6d73a96037ac547b3eda1b78))
* Add notes about GitHub_TOKEN (#145) ([6852043](https://github.com/peaceiris/actions-gh-pages/commit/68520436f89fb253238c54f1ad6c5c3681c3e85b)), closes [#145](https://github.com/peaceiris/actions-gh-pages/issues/145)
* fix user_name ([9571d29](https://github.com/peaceiris/actions-gh-pages/commit/9571d29e0df7e4a5bd5700f5531848e9158d7a2c))
* fix user_name ([eb73e9c](https://github.com/peaceiris/actions-gh-pages/commit/eb73e9cb9d8ed1656b67a83c37e7dc1bc9c0dc00))
* fix user_name ([860ed19](https://github.com/peaceiris/actions-gh-pages/commit/860ed1944f8968c2df2e052bd419a015ec10be38))
# [3.5.0](https://github.com/peaceiris/actions-gh-pages/compare/v3.4.1...v3.5.0) (2020-03-06)

View File

@@ -42,6 +42,8 @@ Three tokens are supported.
| `deploy_key` | ✅️ | ✅️ | SSH | Necessary |
| `personal_token` | ✅️ | ✅️ | HTTPS | Necessary |
Notes: Actually, the `GitHub_TOKEN` works for deploying to GitHub Pages but it has still some limitations. For the first deployment, we need to select the `gh-pages` branch or `master` branch on the repository settings tab. See [First Deployment with `GITHUB_TOKEN`](#%EF%B8%8F-first-deployment-with-github_token)
### Supported Platforms
| runs-on | `github_token` | `deploy_key` | `personal_token` |
@@ -77,6 +79,7 @@ Three tokens are supported.
- [⭐️ Create Git tag](#%EF%B8%8F-create-git-tag)
- [Tips and FAQ](#tips-and-faq)
- [⭐️ Create SSH Deploy Key](#%EF%B8%8F-create-ssh-deploy-key)
- [⭐️ First Deployment with `GITHUB_TOKEN`](#%EF%B8%8F-first-deployment-with-github_token)
- [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release)
- [Examples](#examples)
- [⭐️ Static Site Generators with Node.js](#%EF%B8%8F-static-site-generators-with-nodejs)
@@ -140,13 +143,9 @@ jobs:
The above example is for [Project Pages sites]. (`<username>/<project_name>` repository)
| Actions log overview | Build step log |
| Actions log overview | GitHub Pages log |
|---|---|
| ![](./images/log1.jpg) | ![](./images/log2.jpg) |
| Deploy step log | GitHub Pages log |
|---|---|
| ![](./images/log3.jpg) | ![](./images/log4.jpg) |
| ![](./images/log_overview.jpg) | ![](./images/log_success.jpg) |
### ⭐️ Repository type - User and Organization
@@ -193,7 +192,7 @@ jobs:
### ⭐️ `deploy_key`
Read [⭐️ Create SSH Deploy Key](#%EF%B8%8F-create-ssh-deploy-key), create your SSH deploy key, and set the `deploy_key` option like the following.
Read [Create SSH Deploy Key](#%EF%B8%8F-create-ssh-deploy-key), create your SSH deploy key, and set the `deploy_key` option like the following.
```yaml
- name: Deploy
@@ -328,10 +327,12 @@ A commit is always created with the same user.
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
user_name: iris
user_email: iris@peaceiris.com
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
```
<img width="400px" alt="Add GitHub Actions bot as a committer" src="./images/committer_github_actions_bot.jpg">
### ⭐️ Set custom commit message
Set custom commit message.
@@ -431,6 +432,18 @@ Next, Go to **Repository Settings**
|---|---|
| ![](./images/secrets-1.jpg) | ![](./images/secrets-2.jpg) |
### ⭐️ First Deployment with `GITHUB_TOKEN`
The `GITHUB_TOKEN` has limitations for the first deployment so we have to select the GitHub Pages branch on the repository settings tab.
| First deployment failed | Go to the settings tab |
|---|---|
| ![](./images/log_first_deployment_failed_with_github_token.jpg) | ![](./images/settings_inactive.jpg) |
| Select branch | Deploying again and succeed |
|---|---|
| ![](./images/settings_select.jpg) | ![](./images/log_success.jpg) |
### ⭐️ Use the latest and specific release
We recommend you to use the latest and specific release of this action for stable CI/CD.

116
__tests__/git-utils.test.ts Normal file
View File

@@ -0,0 +1,116 @@
import {getUserName, getUserEmail, setCommitAuthor} from '../src/git-utils';
import {getWorkDirName, createWorkDir} from '../src/utils';
import {CmdResult} from '../src/interfaces';
import * as exec from '@actions/exec';
beforeEach(() => {
jest.resetModules();
process.env['GITHUB_ACTOR'] = 'default-octocat';
process.env['GITHUB_REPOSITORY'] = 'owner/repo';
});
afterEach(() => {
delete process.env['GITHUB_ACTOR'];
delete process.env['GITHUB_REPOSITORY'];
});
describe('getUserName()', () => {
test('get default git user name', () => {
const userName = '';
const test = getUserName(userName);
expect(test).toMatch('default-octocat');
});
test('get custom git user name', () => {
const userName = 'custom-octocat';
const test = getUserName(userName);
expect(test).toMatch(userName);
});
});
describe('getUserEmail()', () => {
test('get default git user email', () => {
const userEmail = '';
const test = getUserEmail(userEmail);
expect(test).toMatch('default-octocat@users.noreply.github.com');
});
test('get custom git user email', () => {
const userEmail = 'custom-octocat@github.com';
const test = getUserEmail(userEmail);
expect(test).toMatch(userEmail);
});
});
describe('setCommitAuthor()', () => {
let workDirName = '';
(async (): Promise<void> => {
const date = new Date();
const unixTime = date.getTime();
workDirName = await getWorkDirName(`${unixTime}`);
})();
beforeEach(async () => {
await createWorkDir(workDirName);
process.chdir(workDirName);
await exec.exec('git', ['init']);
});
test('get default commit author', async () => {
const userName = '';
const userEmail = '';
const result: CmdResult = {
exitcode: 0,
output: ''
};
const options = {
listeners: {
stdout: (data: Buffer): void => {
result.output += data.toString();
}
}
};
await setCommitAuthor(userName, userEmail);
result.exitcode = await exec.exec('git', ['config', 'user.name'], options);
expect(result.output).toMatch('default-octocat');
result.exitcode = await exec.exec('git', ['config', 'user.email'], options);
expect(result.output).toMatch('default-octocat@users.noreply.github.com');
});
test('get custom commit author', async () => {
const userName = 'custom-octocat';
const userEmail = 'custom-octocat@github.com';
const result: CmdResult = {
exitcode: 0,
output: ''
};
const options = {
listeners: {
stdout: (data: Buffer): void => {
result.output += data.toString();
}
}
};
await setCommitAuthor(userName, userEmail);
result.exitcode = await exec.exec('git', ['config', 'user.name'], options);
expect(result.output).toMatch(userName);
result.exitcode = await exec.exec('git', ['config', 'user.email'], options);
expect(result.output).toMatch(userEmail);
});
test('throw error user_email is undefined', async () => {
const userName = 'custom-octocat';
const userEmail = '';
await expect(setCommitAuthor(userName, userEmail)).rejects.toThrowError(
'user_email is undefined'
);
});
test('throw error user_name is undefined', async () => {
const userName = '';
const userEmail = 'custom-octocat@github.com';
await expect(setCommitAuthor(userName, userEmail)).rejects.toThrowError(
'user_name is undefined'
);
});
});

View File

@@ -9,24 +9,24 @@ branding:
color: 'blue'
inputs:
deploy_key:
description: ''
description: 'Set a SSH private key from repository secret value for pushing to the remote branch.'
required: false
github_token:
description: ''
description: 'Set a generated GITHUB_TOKEN for pushing to the remote branch.'
required: false
personal_token:
description: ''
description: 'Set a personal access token for pushing to the remote branch.'
required: false
publish_branch:
description: ''
description: 'Set a target branch for deployment.'
required: false
default: 'gh-pages'
publish_dir:
description: ''
description: 'Set an input directory for deployment.'
required: false
default: 'public'
external_repository:
description: ''
description: 'Set an external repository (owner/repo).'
required: false
allow_empty_commit:
description: 'If empty commits should be made to the publication branch'

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
images/log_overview.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
images/log_success.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
images/settings_select.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -2251,20 +2251,23 @@ const core = __importStar(__webpack_require__(470));
const exec = __importStar(__webpack_require__(986));
const get_inputs_1 = __webpack_require__(452);
const set_tokens_1 = __webpack_require__(615);
const git = __importStar(__webpack_require__(496));
const git_utils_1 = __webpack_require__(496);
const utils_1 = __webpack_require__(163);
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const inps = get_inputs_1.getInputs();
get_inputs_1.showInputs(inps);
yield git.setConfig(inps.UserName, inps.UserEmail);
const isSkipOnFork = yield utils_1.skipOnFork(inps.GithubToken, inps.DeployKey, inps.PersonalToken);
if (isSkipOnFork) {
return;
}
const remoteURL = yield set_tokens_1.setTokens(inps);
core.debug(`[INFO] remoteURL: ${remoteURL}`);
const date = new Date();
const unixTime = date.getTime();
const workDir = yield utils_1.getWorkDirName(`${unixTime}`);
yield git.setRepo(inps, remoteURL, workDir);
yield git_utils_1.setRepo(inps, remoteURL, workDir);
yield utils_1.addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
yield utils_1.addCNAME(workDir, inps.CNAME);
try {
@@ -2275,9 +2278,10 @@ function run() {
}
yield exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
yield exec.exec('git', ['add', '--all']);
yield git.commit(inps.AllowEmptyCommit, inps.ExternalRepository, inps.CommitMessage);
yield git.push(inps.PublishBranch, inps.ForceOrphan);
yield git.pushTag(inps.TagName, inps.TagMessage);
yield git_utils_1.setCommitAuthor(inps.UserName, inps.UserEmail);
yield git_utils_1.commit(inps.AllowEmptyCommit, inps.ExternalRepository, inps.CommitMessage);
yield git_utils_1.push(inps.PublishBranch, inps.ForceOrphan);
yield git_utils_1.pushTag(inps.TagName, inps.TagMessage);
core.info('[INFO] Action successfully completed');
return;
}
@@ -2690,6 +2694,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const github_1 = __webpack_require__(469);
const core = __importStar(__webpack_require__(470));
const io = __importStar(__webpack_require__(1));
const path_1 = __importDefault(__webpack_require__(622));
@@ -2755,6 +2760,22 @@ function addCNAME(workDir, content) {
});
}
exports.addCNAME = addCNAME;
function skipOnFork(githubToken, deployKey, personalToken) {
return __awaiter(this, void 0, void 0, function* () {
const isForkRepository = github_1.context.payload.repository.fork === 'true';
if (isForkRepository) {
if (githubToken) {
return false;
}
if (!deployKey && !personalToken) {
core.warning('Action runs on fork and deploy_key or personal_token is empty');
return true;
}
}
return false;
});
}
exports.skipOnFork = skipOnFork;
/***/ }),
@@ -8519,29 +8540,37 @@ function setRepo(inps, remoteURL, workDir) {
});
}
exports.setRepo = setRepo;
function setConfig(userName, userEmail) {
function getUserName(userName) {
if (userName) {
return userName;
}
else {
return `${process.env.GITHUB_ACTOR}`;
}
}
exports.getUserName = getUserName;
function getUserEmail(userEmail) {
if (userEmail) {
return userEmail;
}
else {
return `${process.env.GITHUB_ACTOR}@users.noreply.github.com`;
}
}
exports.getUserEmail = getUserEmail;
function setCommitAuthor(userName, userEmail) {
return __awaiter(this, void 0, void 0, function* () {
yield exec.exec('git', ['config', '--global', 'gc.auto', '0']);
let name = '';
if (userName) {
name = userName;
if (userName && !userEmail) {
throw new Error('user_email is undefined');
}
else {
name = `${process.env.GITHUB_ACTOR}`;
if (!userName && userEmail) {
throw new Error('user_name is undefined');
}
yield exec.exec('git', ['config', '--global', 'user.name', name]);
let email = '';
if (userName !== '' && userEmail !== '') {
email = userEmail;
}
else {
email = `${process.env.GITHUB_ACTOR}@users.noreply.github.com`;
}
yield exec.exec('git', ['config', '--global', 'user.email', email]);
return;
yield exec.exec('git', ['config', 'user.name', getUserName(userName)]);
yield exec.exec('git', ['config', 'user.email', getUserEmail(userEmail)]);
});
}
exports.setConfig = setConfig;
exports.setCommitAuthor = setCommitAuthor;
function commit(allowEmptyCommit, externalRepository, message) {
return __awaiter(this, void 0, void 0, function* () {
let msg = '';

72
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.5.0",
"version": "3.5.4-3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -740,9 +740,9 @@
}
},
"@types/jest": {
"version": "25.1.3",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.3.tgz",
"integrity": "sha512-jqargqzyJWgWAJCXX96LBGR/Ei7wQcZBvRv0PLEu9ZByMfcs23keUJrKv9FMR6YZf9YCbfqDqgmY+JUBsnqhrg==",
"version": "25.1.4",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.4.tgz",
"integrity": "sha512-QDDY2uNAhCV7TMCITrxz+MRk1EizcsevzfeS6LykIlq2V1E5oO4wXG8V2ZEd9w7Snxeeagk46YbMgZ8ESHx3sw==",
"dev": true,
"requires": {
"jest-diff": "^25.1.0",
@@ -762,9 +762,9 @@
"dev": true
},
"@types/node": {
"version": "12.12.29",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.29.tgz",
"integrity": "sha512-yo8Qz0ygADGFptISDj3pOC9wXfln/5pQaN/ysDIzOaAWXt73cNHmtEC8zSO2Y+kse/txmwIAJzkYZ5fooaS5DQ=="
"version": "12.12.30",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.30.tgz",
"integrity": "sha512-sz9MF/zk6qVr3pAnM0BSQvYIBK44tS75QC5N+VbWSE4DjCV/pJ+UzCW/F+vVnl7TkOPcuwQureKNtSSwjBTaMg=="
},
"@types/parse-json": {
"version": "4.0.0",
@@ -794,12 +794,12 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.22.0.tgz",
"integrity": "sha512-BvxRLaTDVQ3N+Qq8BivLiE9akQLAOUfxNHIEhedOcg8B2+jY8Rc4/D+iVprvuMX1AdezFYautuGDwr9QxqSxBQ==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.23.0.tgz",
"integrity": "sha512-8iA4FvRsz8qTjR0L/nK9RcRUN3QtIHQiOm69FzV7WS3SE+7P7DyGGwh3k4UNR2JBbk+Ej2Io+jLAaqKibNhmtw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "2.22.0",
"@typescript-eslint/experimental-utils": "2.23.0",
"eslint-utils": "^1.4.3",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
@@ -807,20 +807,20 @@
},
"dependencies": {
"@typescript-eslint/experimental-utils": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz",
"integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz",
"integrity": "sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.22.0",
"@typescript-eslint/typescript-estree": "2.23.0",
"eslint-scope": "^5.0.0"
}
},
"@typescript-eslint/typescript-estree": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz",
"integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.23.0.tgz",
"integrity": "sha512-pmf7IlmvXdlEXvE/JWNNJpEvwBV59wtJqA8MLAxMKLXNKVRC3HZBXR/SlZLPWTCcwOSg9IM7GeRSV3SIerGVqw==",
"dev": true,
"requires": {
"debug": "^4.1.1",
@@ -852,32 +852,32 @@
}
},
"@typescript-eslint/parser": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.22.0.tgz",
"integrity": "sha512-FaZKC1X+nvD7qMPqKFUYHz3H0TAioSVFGvG29f796Nc5tBluoqfHgLbSFKsh7mKjRoeTm8J9WX2Wo9EyZWjG7w==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.23.0.tgz",
"integrity": "sha512-k61pn/Nepk43qa1oLMiyqApC6x5eP5ddPz6VUYXCAuXxbmRLqkPYzkFRKl42ltxzB2luvejlVncrEpflgQoSUg==",
"dev": true,
"requires": {
"@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "2.22.0",
"@typescript-eslint/typescript-estree": "2.22.0",
"@typescript-eslint/experimental-utils": "2.23.0",
"@typescript-eslint/typescript-estree": "2.23.0",
"eslint-visitor-keys": "^1.1.0"
},
"dependencies": {
"@typescript-eslint/experimental-utils": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz",
"integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz",
"integrity": "sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.22.0",
"@typescript-eslint/typescript-estree": "2.23.0",
"eslint-scope": "^5.0.0"
}
},
"@typescript-eslint/typescript-estree": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz",
"integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.23.0.tgz",
"integrity": "sha512-pmf7IlmvXdlEXvE/JWNNJpEvwBV59wtJqA8MLAxMKLXNKVRC3HZBXR/SlZLPWTCcwOSg9IM7GeRSV3SIerGVqw==",
"dev": true,
"requires": {
"debug": "^4.1.1",
@@ -943,9 +943,9 @@
"dev": true
},
"acorn": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
"integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==",
"dev": true
},
"acorn-globals": {
@@ -959,9 +959,9 @@
},
"dependencies": {
"acorn": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz",
"integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==",
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==",
"dev": true
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.5.0",
"version": "3.5.4-3",
"description": "GitHub Actions for GitHub Pages",
"main": "lib/index.js",
"engines": {
@@ -56,11 +56,11 @@
"@actions/io": "^1.0.2"
},
"devDependencies": {
"@types/jest": "^25.1.3",
"@types/jest": "^25.1.4",
"@types/js-yaml": "^3.12.2",
"@types/node": "~12",
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.22.0",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"@zeit/ncc": "^0.21.1",
"eslint": "^6.8.0",
"eslint-plugin-jest": "^23.8.2",

View File

@@ -103,29 +103,34 @@ export async function setRepo(
}
}
export async function setConfig(
export function getUserName(userName: string): string {
if (userName) {
return userName;
} else {
return `${process.env.GITHUB_ACTOR}`;
}
}
export function getUserEmail(userEmail: string): string {
if (userEmail) {
return userEmail;
} else {
return `${process.env.GITHUB_ACTOR}@users.noreply.github.com`;
}
}
export async function setCommitAuthor(
userName: string,
userEmail: string
): Promise<void> {
await exec.exec('git', ['config', '--global', 'gc.auto', '0']);
let name = '';
if (userName) {
name = userName;
} else {
name = `${process.env.GITHUB_ACTOR}`;
if (userName && !userEmail) {
throw new Error('user_email is undefined');
}
await exec.exec('git', ['config', '--global', 'user.name', name]);
let email = '';
if (userName !== '' && userEmail !== '') {
email = userEmail;
} else {
email = `${process.env.GITHUB_ACTOR}@users.noreply.github.com`;
if (!userName && userEmail) {
throw new Error('user_name is undefined');
}
await exec.exec('git', ['config', '--global', 'user.email', email]);
return;
await exec.exec('git', ['config', 'user.name', getUserName(userName)]);
await exec.exec('git', ['config', 'user.email', getUserEmail(userEmail)]);
}
export async function commit(

View File

@@ -3,15 +3,22 @@ import * as exec from '@actions/exec';
import {Inputs} from './interfaces';
import {showInputs, getInputs} from './get-inputs';
import {setTokens} from './set-tokens';
import * as git from './git-utils';
import {getWorkDirName, addNoJekyll, addCNAME} from './utils';
import {setRepo, setCommitAuthor, commit, push, pushTag} from './git-utils';
import {getWorkDirName, addNoJekyll, addCNAME, skipOnFork} from './utils';
export async function run(): Promise<void> {
try {
const inps: Inputs = getInputs();
showInputs(inps);
await git.setConfig(inps.UserName, inps.UserEmail);
const isSkipOnFork = await skipOnFork(
inps.GithubToken,
inps.DeployKey,
inps.PersonalToken
);
if (isSkipOnFork) {
return;
}
const remoteURL = await setTokens(inps);
core.debug(`[INFO] remoteURL: ${remoteURL}`);
@@ -19,7 +26,7 @@ export async function run(): Promise<void> {
const date = new Date();
const unixTime = date.getTime();
const workDir = await getWorkDirName(`${unixTime}`);
await git.setRepo(inps, remoteURL, workDir);
await setRepo(inps, remoteURL, workDir);
await addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
await addCNAME(workDir, inps.CNAME);
@@ -31,14 +38,14 @@ export async function run(): Promise<void> {
}
await exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
await exec.exec('git', ['add', '--all']);
await git.commit(
await setCommitAuthor(inps.UserName, inps.UserEmail);
await commit(
inps.AllowEmptyCommit,
inps.ExternalRepository,
inps.CommitMessage
);
await git.push(inps.PublishBranch, inps.ForceOrphan);
await git.pushTag(inps.TagName, inps.TagMessage);
await push(inps.PublishBranch, inps.ForceOrphan);
await pushTag(inps.TagName, inps.TagMessage);
core.info('[INFO] Action successfully completed');

View File

@@ -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,28 @@ 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) {
if (githubToken) {
return false;
}
if (!deployKey && !personalToken) {
core.warning(
'Action runs on fork and deploy_key or personal_token is empty'
);
return true;
}
}
return false;
}