Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github action test #6

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/CODEOWNERS

This file was deleted.

20 changes: 20 additions & 0 deletions .github/actions/action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { getInput, setFailed } from "@actions/core"
import { context, getOctokit } from "@actions/github"

try {
const reviewers = getInput("reviewers")
const token = getInput("github_token")
const octokit = getOctokit(token)

const { owner, repo } = context.repo
const pull_number = context.issue.number

await octokit.rest.pulls.requestReviewers({
owner,
repo,
pull_number,
reviewers: reviewers.split(", "),
})
} catch (error) {
setFailed(error.message)
}
11 changes: 11 additions & 0 deletions .github/actions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "core"

inputs:
reviewers:
required: true
github_token:
required: true

runs:
using: "node16"
main: "action.js"
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: deploy

on:
pull_request:
types: [opened, ready_for_review]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Cache node modules
uses: actions/cache@v3
id: npm-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo 'npm cache existed'
npm ci

- name: Assign reviewers randomly
uses: ./.github/actions/core
with:
github_token: ${{secrets.token}}
reviewers: ${{vars.reviewers}}
17 changes: 0 additions & 17 deletions .github/workflows/review.yml

This file was deleted.

203 changes: 200 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
]
},
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@chakra-ui/react": "^2.8.2",
"@chakra-ui/theme-tools": "^2.1.2",
"@tanstack/react-query": "^5.18.1",
Expand Down
5 changes: 5 additions & 0 deletions src/test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Test = () => {
return <div></div>
}

export default Test
Loading