Skip to content

Commit 86c3352

Browse files
committed
chore: get input from @actions/core instead of env
1 parent 7294871 commit 86c3352

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

action.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,6 @@ runs:
4343
run: ${{ github.action_path }}/scripts/checkout.sh
4444
shell: bash
4545
- name: Run Ryu-Cho
46-
env:
47-
ACCESS_TOKEN: ${{ inputs.access-token }}
48-
USER_NAME: ${{ inputs.username }}
49-
EMAIL: ${{ inputs.email }}
50-
UPSTREAM_REPO: ${{ inputs.upstream-repo }}
51-
UPSTREAM_REPO_BRANCH: ${{ inputs.upstream-repo-branch }}
52-
HEAD_REPO: ${{ inputs.head-repo }}
53-
HEAD_REPO_BRANCH: ${{ inputs.head-repo-branch }}
54-
TRACK_FROM: ${{ inputs.track-from }}
55-
PATH_STARTS_WITH: ${{ inputs.path-starts-with }}
56-
WORKFLOW_NAME: ${{ inputs.workflow-name }}
5746
run: |
5847
cd ryu-cho
5948
yarn install

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"test": "yarn lint && yarn jest"
99
},
1010
"dependencies": {
11+
"@actions/core": "^1.9.0",
1112
"@octokit/rest": "^18.3.0",
1213
"@types/node": "^14.14.31",
1314
"@types/shelljs": "^0.8.8",

src/index.ts

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
import { assert } from './utils'
21
import { createConfig } from './config'
32
import { RyuCho } from './ryu-cho'
4-
5-
assert(!!process.env.ACCESS_TOKEN, '`accessToken` is required.')
6-
assert(!!process.env.USER_NAME, '`userName` is required.')
7-
assert(!!process.env.EMAIL, '`email` is required.')
8-
assert(!!process.env.UPSTREAM_REPO, '`upstreamRepo` is required.')
9-
assert(!!process.env.HEAD_REPO, '`headRepo` is required.')
10-
assert(!!process.env.TRACK_FROM, '`trackFrom` is required.')
3+
import core from '@actions/core'
114

125
const config = createConfig({
13-
accessToken: process.env.ACCESS_TOKEN!,
14-
userName: process.env.USER_NAME!,
15-
email: process.env.EMAIL!,
16-
upstreamRepo: process.env.UPSTREAM_REPO!,
17-
upstreamRepoBranch: process.env.UPSTREAM_REPO_BRANCH,
18-
headRepo: process.env.HEAD_REPO!,
19-
headRepoBranch: process.env.HEAD_REPO_BRANCH,
20-
workflowName: process.env.WORKFLOW_NAME,
21-
trackFrom: process.env.TRACK_FROM!,
22-
pathStartsWith: process.env.PATH_STARTS_WITH
6+
accessToken: core.getInput('access-token', { required: true }),
7+
userName: core.getInput('username', { required: true }),
8+
email: core.getInput('email', { required: true }),
9+
upstreamRepo: core.getInput('upstream-repo', { required: true }),
10+
upstreamRepoBranch: core.getInput('upstream-repo-branch', { required: true }),
11+
headRepo: core.getInput('head-repo', { required: true }),
12+
headRepoBranch: core.getInput('head-repo-branch'),
13+
workflowName: core.getInput('workflow-name'),
14+
trackFrom: core.getInput('track-from', { required: true }),
15+
pathStartsWith: core.getInput('path-starts-with'),
2316
})
2417

2518
const ryuCho = new RyuCho(config)

0 commit comments

Comments
 (0)