Skip to content

Commit

Permalink
feat: Merge sub-actions (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris authored Sep 15, 2020
1 parent 667f6bf commit 2dc3689
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 228 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/suggest-related-links-train.yml

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/suggest-related-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ on:
types:
- opened
- edited
workflow_dispatch:
schedule:
- cron: '13 13 * * */7'

jobs:
suggest:
action:
runs-on: ubuntu-18.04
steps:
- uses: peaceiris/actions-suggest-related-links@v0.4.0
with:
repository: 'peaceiris/actions-gh-pages'
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
## Suggest Related Links Action

A GitHub Action to suggest related or similar issues, documents, and links. Based on the power of NLP and fastText.



## 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** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Suggest Related Links Action](#suggest-related-links-action)

- [Maintainers](#maintainers)
- [License](#license)

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

## Suggest Related Links Action

A GitHub Action to suggest related or similar issues, documents, and links. Based on the power of NLP and fastText.

## Maintainers

- [peaceiris (Shohei Ueda)](https://github.com/peaceiris)
- [S-Kaisei (Kaisei Shimura)](https://github.com/S-Kaisei)



## License

MIT License

## Maintainers
<div align="right"><a href="#table-of-contents">Back to TOC ☝️</a></div>
14 changes: 13 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'A GitHub Action to suggest related or similar issues, documents, a
author: 'peaceiris'
runs:
using: 'node12'
main: 'actions/suggest/dist/index.js'
main: 'actions/dist/index.js'
branding:
icon: 'link'
color: 'orange'
Expand All @@ -28,6 +28,18 @@ inputs:
description: 'Set a model for suggesting.'
default: 'fasttext'
required: false
repository:
description: 'Set a repository name of issue source. (e.g. peaceiris/actions-gh-pages)'
default: ${{ github.repository }}
required: false
custom_training_data:
description: 'Set paths to JSON files including custom training data.'
default: ''
required: false
train_issues:
description: 'Set this to true to train issue data.'
default: 'true'
required: false
outputs:
json_path:
description: 'A path to a JSON file that contains results.'
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ beforeEach(() => {
process.stdout.write = jest.fn();

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const doc: any = yaml.safeLoad(fs.readFileSync(__dirname + '/../action.yml', 'utf8'));
const doc: any = yaml.safeLoad(fs.readFileSync(__dirname + '/../../action.yml', 'utf8'));
Object.keys(doc.inputs).forEach(name => {
const envVar = `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
process.env[envVar] = doc.inputs[name]['default'];
Expand All @@ -19,7 +19,7 @@ beforeEach(() => {

afterEach(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const doc: any = yaml.safeLoad(fs.readFileSync(__dirname + '/../action.yml', 'utf8'));
const doc: any = yaml.safeLoad(fs.readFileSync(__dirname + '/../../action.yml', 'utf8'));
Object.keys(doc.inputs).forEach(name => {
const envVar = `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
console.debug(`delete ${envVar}\t${process.env[envVar]}`);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 0 additions & 9 deletions actions/suggest/README.md

This file was deleted.

74 changes: 0 additions & 74 deletions actions/suggest/__tests__/get-inputs.test.ts

This file was deleted.

17 changes: 0 additions & 17 deletions actions/suggest/src/get-inputs.ts

This file was deleted.

9 changes: 0 additions & 9 deletions actions/suggest/src/interfaces.ts

This file was deleted.

27 changes: 0 additions & 27 deletions actions/suggest/src/main.ts

This file was deleted.

9 changes: 0 additions & 9 deletions actions/train/README.md

This file was deleted.

37 changes: 0 additions & 37 deletions actions/train/action.yml

This file was deleted.

10 changes: 0 additions & 10 deletions actions/train/src/index.ts

This file was deleted.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "actions-suggest-related-links",
"version": "0.4.0",
"description": "A GitHub Action to suggest related or similar issues, documents, and links. Based on the power of NLP and fastText.",
"main": "lib/index.js",
"main": "actions/dist/index.js",
"engines": {
"node": ">=12.18.3",
"npm": ">=6.14.8"
Expand All @@ -13,9 +13,7 @@
"lint": "eslint ./actions/**/*.ts",
"lint:fix": "eslint --fix ./actions/**/*.ts",
"test": "jest --coverage --verbose --detectOpenHandles",
"build": "npm run build:suggest && npm run build:train",
"build:suggest": "ncc build ./actions/suggest/src/index.ts -o ./actions/suggest/dist --minify",
"build:train": "ncc build ./actions/train/src/index.ts -o ./actions/train/dist --minify",
"build": "ncc build ./actions/src/index.ts -o ./actions/dist --minify",
"tsc": "tsc",
"fmt": "prettier --write **/*.ts",
"fmt:check": "prettier --check **/*.ts",
Expand Down
6 changes: 2 additions & 4 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ fi
npm ci

npm run build
git add ./actions/suggest/dist/index.js
git add ./actions/train/dist/index.js
git add ./actions/dist/index.js
git commit -m "chore(release): Add build assets"

npm run release -- --release-as "${RELEASE_TYPE}" --preset eslint

git rm ./actions/suggest/dist/index.js
git rm ./actions/train/dist/index.js
git rm ./actions/dist/index.js
git commit -m "chore(release): Remove build assets [skip ci]"

if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then
Expand Down

0 comments on commit 2dc3689

Please sign in to comment.