Skip to content

Commit

Permalink
chore: get input from @actions/core instead of env
Browse files Browse the repository at this point in the history
  • Loading branch information
tony19 committed Jul 22, 2022
1 parent 7294871 commit 86c3352
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 29 deletions.
11 changes: 0 additions & 11 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ runs:
run: ${{ github.action_path }}/scripts/checkout.sh
shell: bash
- name: Run Ryu-Cho
env:
ACCESS_TOKEN: ${{ inputs.access-token }}
USER_NAME: ${{ inputs.username }}
EMAIL: ${{ inputs.email }}
UPSTREAM_REPO: ${{ inputs.upstream-repo }}
UPSTREAM_REPO_BRANCH: ${{ inputs.upstream-repo-branch }}
HEAD_REPO: ${{ inputs.head-repo }}
HEAD_REPO_BRANCH: ${{ inputs.head-repo-branch }}
TRACK_FROM: ${{ inputs.track-from }}
PATH_STARTS_WITH: ${{ inputs.path-starts-with }}
WORKFLOW_NAME: ${{ inputs.workflow-name }}
run: |
cd ryu-cho
yarn install
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"test": "yarn lint && yarn jest"
},
"dependencies": {
"@actions/core": "^1.9.0",
"@octokit/rest": "^18.3.0",
"@types/node": "^14.14.31",
"@types/shelljs": "^0.8.8",
Expand Down
29 changes: 11 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import { assert } from './utils'
import { createConfig } from './config'
import { RyuCho } from './ryu-cho'

assert(!!process.env.ACCESS_TOKEN, '`accessToken` is required.')
assert(!!process.env.USER_NAME, '`userName` is required.')
assert(!!process.env.EMAIL, '`email` is required.')
assert(!!process.env.UPSTREAM_REPO, '`upstreamRepo` is required.')
assert(!!process.env.HEAD_REPO, '`headRepo` is required.')
assert(!!process.env.TRACK_FROM, '`trackFrom` is required.')
import core from '@actions/core'

const config = createConfig({
accessToken: process.env.ACCESS_TOKEN!,
userName: process.env.USER_NAME!,
email: process.env.EMAIL!,
upstreamRepo: process.env.UPSTREAM_REPO!,
upstreamRepoBranch: process.env.UPSTREAM_REPO_BRANCH,
headRepo: process.env.HEAD_REPO!,
headRepoBranch: process.env.HEAD_REPO_BRANCH,
workflowName: process.env.WORKFLOW_NAME,
trackFrom: process.env.TRACK_FROM!,
pathStartsWith: process.env.PATH_STARTS_WITH
accessToken: core.getInput('access-token', { required: true }),
userName: core.getInput('username', { required: true }),
email: core.getInput('email', { required: true }),
upstreamRepo: core.getInput('upstream-repo', { required: true }),
upstreamRepoBranch: core.getInput('upstream-repo-branch', { required: true }),
headRepo: core.getInput('head-repo', { required: true }),
headRepoBranch: core.getInput('head-repo-branch'),
workflowName: core.getInput('workflow-name'),
trackFrom: core.getInput('track-from', { required: true }),
pathStartsWith: core.getInput('path-starts-with'),
})

const ryuCho = new RyuCho(config)
Expand Down

0 comments on commit 86c3352

Please sign in to comment.