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 Jul 2, 2021
1 parent b39a1ba commit 0c45a72
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
31 changes: 30 additions & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,41 @@ jobs:
Result:
```shell
Run echo '["yarn.lock"]' | jq .
> Run echo '["yarn.lock"]' | jq .
[
"yarn.lock"
]
```

### 相対パスを指定

GitHub Actions は `uses``working-directory` を指定できないため、モノレポ構成などで個別に実行したい場合に対応できませんが、`RELATIVE` オプションを指定すると `git diff``--relative=<RELATIVE>` として使用されます。

https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---relativeltpathgt

```yaml
on: pull_request
name: CI
jobs:
dump:
name: Dump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: '*.ts'
RELATIVE: 'src/abc'
- run: echo ${{ env.GIT_DIFF }}
```
`src/abc/test1.ts`, `src/abc/test2.ts`, `src/abc/test3.txt`, `src/test4.ts` のファイルがある場合、結果は以下のようになります。

```shell
> Run echo 'test1.ts' 'test2.ts'
test1.ts test2.ts
```

## Author
[GitHub (Technote)](https://github.com/technote-space)

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ Run echo '["yarn.lock"]' | jq .
]
```

###

## Author
[GitHub (Technote)](https://github.com/technote-space)

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":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v4.1.3","branch":"gh-actions","tags":["test/v4.1.3","test/v4.1","test/v4"],"updated_at":"2021-07-02T15:26:30.615Z"}
{"owner":"technote-space","repo":"get-diff-action","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v4.1.3","branch":"gh-actions","tags":["test/v4.1.3","test/v4.1","test/v4"],"updated_at":"2021-07-02T17:07:36.607Z"}
12 changes: 6 additions & 6 deletions lib/utils/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.sumResults = exports.getMatchedFiles = exports.getDiffFiles = exports.getGitDiff = exports.getFileDiff = void 0;
const path_1 = __importDefault(require("path"));
const path_1 = require("path");
const core_1 = require("@actions/core");
const multimatch_1 = __importDefault(require("multimatch"));
const github_action_helper_1 = require("@technote-space/github-action-helper");
Expand All @@ -30,11 +30,11 @@ const escapeWhenJsonFormat = () => github_action_helper_1.Utils.getBoolValue(get
const getSeparator = () => getRawInput('SEPARATOR');
const getPatterns = () => github_action_helper_1.Utils.getArrayInput('PATTERNS', undefined, '');
const getFiles = () => github_action_helper_1.Utils.getArrayInput('FILES', undefined, '');
const getWorkspace = () => github_action_helper_1.Utils.getBoolValue(core_1.getInput('ABSOLUTE')) ? (github_action_helper_1.Utils.getWorkspace() + '/') : '';
const getWorkspace = (relative) => github_action_helper_1.Utils.getBoolValue(core_1.getInput('ABSOLUTE')) ? (path_1.join(github_action_helper_1.Utils.getWorkspace(), relative) + '/') : '';
const getSummaryIncludeFilesFlag = () => github_action_helper_1.Utils.getBoolValue(core_1.getInput('SUMMARY_INCLUDE_FILES'));
const isFilterIgnored = (item, files) => !!(files.length && files.includes(path_1.default.basename(item)));
const isFilterIgnored = (item, files) => !!(files.length && files.includes(path_1.basename(item)));
const isMatched = (item, patterns, options) => !patterns.length || !!multimatch_1.default(item, patterns, options).length;
const toAbsolute = (item, workspace) => workspace + item;
const toAbsolute = (item, workspace) => path_1.join(workspace, item);
const getMatchOptions = () => ({
nobrace: github_action_helper_1.Utils.getBoolValue(core_1.getInput('MINIMATCH_OPTION_NOBRACE')),
noglobstar: github_action_helper_1.Utils.getBoolValue(core_1.getInput('MINIMATCH_OPTION_NOGLOBSTAR')),
Expand Down Expand Up @@ -91,11 +91,11 @@ const getGitDiff = (logger, context) => __awaiter(void 0, void 0, void 0, functi
], github_action_helper_1.Utils.uniqueArray(refs).map(ref => github_action_helper_1.Utils.getRefspec(ref, constant_1.REMOTE_NAME)));
const dot = getDot();
const files = getFiles();
const workspace = getWorkspace();
const relative = getRelativePath();
const workspace = getWorkspace(relative);
const patterns = getPatterns();
const options = getMatchOptions();
const filter = getFilter();
const relative = getRelativePath();
return (yield github_action_helper_1.Utils.split((yield command.execAsync({
command: 'git diff',
args: [
Expand Down

0 comments on commit 0c45a72

Please sign in to comment.