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 Jan 17, 2020
1 parent 576e332 commit b74e990
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 2 deletions.
133 changes: 133 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Get Diff Action

[![CI Status](https://github.com/technote-space/get-diff-action/workflows/CI/badge.svg)](https://github.com/technote-space/get-diff-action/actions)
[![codecov](https://codecov.io/gh/technote-space/get-diff-action/branch/master/graph/badge.svg)](https://codecov.io/gh/technote-space/get-diff-action)
[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/get-diff-action/badge)](https://www.codefactor.io/repository/github/technote-space/get-diff-action)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/get-diff-action/blob/master/LICENSE)

*Read this in other languages: [English](README.md), [日本語](README.ja.md).*

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

<!-- 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**

- [スクリーンショット](#%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)
- [動作](#%E5%8B%95%E4%BD%9C)
- [Action イベント詳細](#action-%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E8%A9%B3%E7%B4%B0)
- [対象イベント](#%E5%AF%BE%E8%B1%A1%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88)
- [Author](#author)

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

## スクリーンショット
1. Workflow の例
![Example workflow](https://raw.githubusercontent.com/technote-space/get-diff-action/images/workflow.png)
1. スキップ
![Skip](https://raw.githubusercontent.com/technote-space/get-diff-action/images/skip.png)

## 使用方法
```yaml
on: pull_request
name: CI
jobs:
eslint:
name: ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 3
- uses: technote-space/get-diff-action@v1
id: git-diff
with:
PREFIX_FILTER: |
src
__tests__
SUFFIX_FILTER: .ts
- name: Install Package dependencies
run: yarn install
if: steps.git-diff.outputs.diff
- name: Check code style
# 差分があるソースコードだけチェック
run: yarn eslint ${{ steps.git-diff.outputs.diff }}
if: steps.git-diff.outputs.diff
```
以下のソースコードに差分がない場合、この Workflow はコードのスタイルチェックをスキップします。
- `src/**/*.ts`
- `__tests__/**/*.ts`

## 動作
1. `git diff` を取得

```shell script
git diff "${FROM}"${DOT}"${TO}" '--diff-filter=${DIFF_FILTER}' --name-only
```

例:(default)
```yaml
FROM: 'origin/${GITHUB_BASE_REF}'
TO: '${GITHUB_REF#refs/}'
DOT: '...'
DIFF_FILTER: 'AM'
```
=>
```shell script
git diff "origin/${GITHUB_BASE_REF}"..."${GITHUB_REF#refs/}" '--diff-filter=AM' --name-only
```
=>
```
.github/workflows/ci.yml
__tests__/utils/command.test.ts
package.json
src/main.ts
src/utils/command.ts
yarn.lock
```
1. `PREFIX_FILTER` や `SUFFIX_FILTER` オプションによるフィルタ
例:
```yaml
SUFFIX_FILTER: .ts
PREFIX_FILTER: src/
```
=>
```
src/main.ts
src/utils/command.ts
```

1. `ABSOLUTE` オプションがtrue(default)の場合に絶対パスに変換

例:(default)
```
/home/runner/work/my-repo-name/my-repo-name/src/main.ts
/home/runner/work/my-repo-name/my-repo-name/src/utils/command.ts
```

1. `SEPARATOR` オプションの値で結合

例:
```yaml
SEPARATOR: ' '
```
=>
```
/home/runner/work/my-repo-name/my-repo-name/src/main.ts /home/runner/work/my-repo-name/my-repo-name/src/utils/command.ts
```

## Action イベント詳細
### 対象イベント
| eventName | action |
|:---:|:---:|
|pull_request|opened, reopened, rerequested, synchronize|

もしこれ以外のイベントで呼ばれた場合、結果は空になります。

## Author
[GitHub (Technote)](https://github.com/technote-space)
[Blog](https://technote.space)
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/get-diff-action/badge)](https://www.codefactor.io/repository/github/technote-space/get-diff-action)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/get-diff-action/blob/master/LICENSE)

*Read this in other languages: [English](README.md), [日本語](README.ja.md).*

GitHub actions to get git diff.

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
Expand All @@ -22,7 +24,7 @@ GitHub actions to get git diff.

## Screenshots
1. Example workflow
![Example workflow ](https://raw.githubusercontent.com/technote-space/get-diff-action/images/workflow.png)
![Example workflow](https://raw.githubusercontent.com/technote-space/get-diff-action/images/workflow.png)
1. Skip
![Skip](https://raw.githubusercontent.com/technote-space/get-diff-action/images/skip.png)

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":"462e53389ef6b9e9f853dbc647ba3f4f405b4ccb","ref":"refs/tags/v1.0.0","tagName":"v1.0.0","branch":"gh-actions","tags":["v1","v1.0","v1.0.0"],"updated_at":"2020-01-17T13:03:16.354Z"}
{"owner":"technote-space","repo":"get-diff-action","sha":"714906ec46a933824b070f4cce79d6e134d54bcd","ref":"refs/tags/v1.0.1","tagName":"v1.0.1","branch":"gh-actions","tags":["v1","v1.0","v1.0.1"],"updated_at":"2020-01-17T13:33:03.572Z"}

0 comments on commit b74e990

Please sign in to comment.