Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit ed1b55d

Browse files
feat: Build for release
1 parent 84b277b commit ed1b55d

File tree

99 files changed

+83487
-7352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+83487
-7352
lines changed

README.ja.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99

1010
これは `git diff` を取得するための GitHub Actions です。
1111

12+
## Table of Contents
13+
1214
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1315
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
14-
**Table of Contents**
16+
<details>
17+
<summary>Details</summary>
1518

1619
- [スクリーンショット](#%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88)
1720
- [使用方法](#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)
@@ -26,6 +29,7 @@
2629
- [対象イベント](#%E5%AF%BE%E8%B1%A1%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88)
2730
- [Author](#author)
2831

32+
</details>
2933
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3034

3135
## スクリーンショット
@@ -44,8 +48,6 @@ jobs:
4448
runs-on: ubuntu-latest
4549
steps:
4650
- uses: actions/checkout@v2
47-
with:
48-
fetch-depth: 3
4951
- uses: technote-space/get-diff-action@v1
5052
id: git-diff
5153
with:

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99

1010
GitHub actions to get git diff.
1111

12+
## Table of Contents
13+
1214
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1315
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
14-
**Table of Contents**
16+
<details>
17+
<summary>Details</summary>
1518

1619
- [Screenshots](#screenshots)
1720
- [Usage](#usage)
@@ -26,6 +29,7 @@ GitHub actions to get git diff.
2629
- [Target events](#target-events)
2730
- [Author](#author)
2831

32+
</details>
2933
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3034

3135
## Screenshots
@@ -44,8 +48,6 @@ jobs:
4448
runs-on: ubuntu-latest
4549
steps:
4650
- uses: actions/checkout@v2
47-
with:
48-
fetch-depth: 3
4951
- uses: technote-space/get-diff-action@v1
5052
with:
5153
PREFIX_FILTER: |

build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"owner":"technote-space","repo":"get-diff-action","sha":"46568e20fd776100c61334388887ffff4ea10f58","ref":"refs/tags/v1.1.2","tagName":"v1.1.2","branch":"gh-actions","tags":["v1","v1.1","v1.1.2"],"updated_at":"2020-01-27T07:41:12.956Z"}
1+
{"owner":"technote-space","repo":"get-diff-action","sha":"a9d328c866aa4e8060adc1e84949a936ce342b1d","ref":"refs/tags/v1.1.3","tagName":"v1.1.3","branch":"gh-actions","tags":["v1.1.3","v1.1","v1"],"updated_at":"2020-02-06T05:44:07.733Z"}

lib/main.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1414
Object.defineProperty(exports, "__esModule", { value: true });
1515
const path_1 = __importDefault(require("path"));
1616
const core_1 = require("@actions/core");
17-
const github_1 = require("@actions/github");
17+
const context_1 = require("@actions/github/lib/context");
1818
const filter_github_action_1 = require("@technote-space/filter-github-action");
1919
const github_action_helper_1 = require("@technote-space/github-action-helper");
2020
const process_1 = require("./process");
@@ -25,8 +25,9 @@ const constant_1 = require("./constant");
2525
function run() {
2626
return __awaiter(this, void 0, void 0, function* () {
2727
const logger = new github_action_helper_1.Logger();
28-
github_action_helper_1.ContextHelper.showActionInfo(path_1.default.resolve(__dirname, '..'), logger, github_1.context);
29-
if (!filter_github_action_1.isTargetEvent(constant_1.TARGET_EVENTS, github_1.context)) {
28+
const context = new context_1.Context();
29+
github_action_helper_1.ContextHelper.showActionInfo(path_1.default.resolve(__dirname, '..'), logger, context);
30+
if (!filter_github_action_1.isTargetEvent(constant_1.TARGET_EVENTS, context)) {
3031
logger.info('This is not target event.');
3132
yield process_1.execute(logger, []);
3233
return;

lib/process.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
1111
Object.defineProperty(exports, "__esModule", { value: true });
1212
const core_1 = require("@actions/core");
1313
const command_1 = require("./utils/command");
14-
const command_2 = require("./utils/command");
1514
exports.dumpDiffs = (diffs, logger) => {
1615
logger.startProcess('Dump diffs');
1716
console.log(diffs);
1817
logger.endProcess();
1918
};
2019
exports.setResult = (diffs, logger) => {
21-
const result = command_2.getDiffFiles(diffs);
22-
const insertions = command_2.sumResults(diffs, item => item.insertions);
23-
const deletions = command_2.sumResults(diffs, item => item.deletions);
20+
const result = command_1.getDiffFiles(diffs);
21+
const insertions = command_1.sumResults(diffs, item => item.insertions);
22+
const deletions = command_1.sumResults(diffs, item => item.deletions);
2423
logger.startProcess('Dump output');
2524
[
2625
{ name: 'diff', value: result, envNameSuffix: '' },
@@ -41,7 +40,7 @@ exports.setResult = (diffs, logger) => {
4140
logger.endProcess();
4241
};
4342
exports.execute = (logger, diffs) => __awaiter(void 0, void 0, void 0, function* () {
44-
const _diff = (diffs !== null && diffs !== void 0 ? diffs : yield command_1.getGitDiff());
43+
const _diff = (diffs !== null && diffs !== void 0 ? diffs : yield command_1.getGitDiff(logger));
4544
exports.dumpDiffs(_diff, logger);
4645
exports.setResult(_diff, logger);
4746
});

lib/utils/command.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ exports.getFileDiff = (file, between) => __awaiter(void 0, void 0, void 0, funct
5454
const deletions = Number.parseInt((_b = stdout.match(/ (\d+) deletions?\(/), (_b !== null && _b !== void 0 ? _b : ['', '0']))[1]);
5555
return { insertions, deletions, lines: insertions + deletions };
5656
});
57-
exports.getGitDiff = () => __awaiter(void 0, void 0, void 0, function* () {
57+
exports.getGitDiff = (logger) => __awaiter(void 0, void 0, void 0, function* () {
58+
if (!github_action_helper_1.Utils.isCloned(github_action_helper_1.Utils.getWorkspace())) {
59+
logger.warn('Please checkout before call this action.');
60+
return [];
61+
}
5862
const files = getFiles();
5963
const prefix = getPrefix();
6064
const suffix = getSuffix();

0 commit comments

Comments
 (0)