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

Commit

Permalink
feat: Build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 6, 2020
1 parent 84b277b commit ed1b55d
Show file tree
Hide file tree
Showing 99 changed files with 83,487 additions and 7,352 deletions.
8 changes: 5 additions & 3 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@

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

## Table of Contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**
<details>
<summary>Details</summary>

- [スクリーンショット](#%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)
- [使用方法](#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)
Expand All @@ -26,6 +29,7 @@
- [対象イベント](#%E5%AF%BE%E8%B1%A1%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88)
- [Author](#author)

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

## スクリーンショット
Expand All @@ -44,8 +48,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 3
- uses: technote-space/get-diff-action@v1
id: git-diff
with:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@

GitHub actions to get git diff.

## Table of Contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**
<details>
<summary>Details</summary>

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

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

## Screenshots
Expand All @@ -44,8 +48,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 3
- uses: technote-space/get-diff-action@v1
with:
PREFIX_FILTER: |
Expand Down
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -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"}
{"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"}
7 changes: 4 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const core_1 = require("@actions/core");
const github_1 = require("@actions/github");
const context_1 = require("@actions/github/lib/context");
const filter_github_action_1 = require("@technote-space/filter-github-action");
const github_action_helper_1 = require("@technote-space/github-action-helper");
const process_1 = require("./process");
Expand All @@ -25,8 +25,9 @@ const constant_1 = require("./constant");
function run() {
return __awaiter(this, void 0, void 0, function* () {
const logger = new github_action_helper_1.Logger();
github_action_helper_1.ContextHelper.showActionInfo(path_1.default.resolve(__dirname, '..'), logger, github_1.context);
if (!filter_github_action_1.isTargetEvent(constant_1.TARGET_EVENTS, github_1.context)) {
const context = new context_1.Context();
github_action_helper_1.ContextHelper.showActionInfo(path_1.default.resolve(__dirname, '..'), logger, context);
if (!filter_github_action_1.isTargetEvent(constant_1.TARGET_EVENTS, context)) {
logger.info('This is not target event.');
yield process_1.execute(logger, []);
return;
Expand Down
9 changes: 4 additions & 5 deletions lib/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@actions/core");
const command_1 = require("./utils/command");
const command_2 = require("./utils/command");
exports.dumpDiffs = (diffs, logger) => {
logger.startProcess('Dump diffs');
console.log(diffs);
logger.endProcess();
};
exports.setResult = (diffs, logger) => {
const result = command_2.getDiffFiles(diffs);
const insertions = command_2.sumResults(diffs, item => item.insertions);
const deletions = command_2.sumResults(diffs, item => item.deletions);
const result = command_1.getDiffFiles(diffs);
const insertions = command_1.sumResults(diffs, item => item.insertions);
const deletions = command_1.sumResults(diffs, item => item.deletions);
logger.startProcess('Dump output');
[
{ name: 'diff', value: result, envNameSuffix: '' },
Expand All @@ -41,7 +40,7 @@ exports.setResult = (diffs, logger) => {
logger.endProcess();
};
exports.execute = (logger, diffs) => __awaiter(void 0, void 0, void 0, function* () {
const _diff = (diffs !== null && diffs !== void 0 ? diffs : yield command_1.getGitDiff());
const _diff = (diffs !== null && diffs !== void 0 ? diffs : yield command_1.getGitDiff(logger));
exports.dumpDiffs(_diff, logger);
exports.setResult(_diff, logger);
});
6 changes: 5 additions & 1 deletion lib/utils/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ exports.getFileDiff = (file, between) => __awaiter(void 0, void 0, void 0, funct
const deletions = Number.parseInt((_b = stdout.match(/ (\d+) deletions?\(/), (_b !== null && _b !== void 0 ? _b : ['', '0']))[1]);
return { insertions, deletions, lines: insertions + deletions };
});
exports.getGitDiff = () => __awaiter(void 0, void 0, void 0, function* () {
exports.getGitDiff = (logger) => __awaiter(void 0, void 0, void 0, function* () {
if (!github_action_helper_1.Utils.isCloned(github_action_helper_1.Utils.getWorkspace())) {
logger.warn('Please checkout before call this action.');
return [];
}
const files = getFiles();
const prefix = getPrefix();
const suffix = getSuffix();
Expand Down
Loading

0 comments on commit ed1b55d

Please sign in to comment.