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

check debug test #9

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a106857
first commit
tommykw Sep 8, 2020
5399f6b
first github actions
tommykw Sep 8, 2020
296b1f6
Add actions/checkout@v2
tommykw Sep 8, 2020
6c14a57
debug add pr comment
tommykw Sep 8, 2020
14d8278
debug pr
tommykw Sep 8, 2020
02c02b2
debug test
tommykw Sep 8, 2020
bcade18
debug test
tommykw Sep 8, 2020
3ebc644
debug test
tommykw Sep 8, 2020
706574e
debug test
tommykw Sep 8, 2020
798ee8b
debug test
tommykw Sep 8, 2020
15c0044
debug test
tommykw Sep 8, 2020
578c579
debug test
tommykw Sep 8, 2020
76e2ddf
debug test
tommykw Sep 8, 2020
31429ed
debug test
tommykw Sep 8, 2020
718baec
debug test
tommykw Sep 8, 2020
b9595c3
debug test
tommykw Sep 8, 2020
0da9610
debug test
tommykw Sep 8, 2020
4d1522a
debug test
tommykw Sep 8, 2020
cd8b765
debug test
tommykw Sep 8, 2020
5ff29ae
debug test
tommykw Sep 8, 2020
85d4e79
debug test
tommykw Sep 8, 2020
63a5f2c
debug test
tommykw Sep 8, 2020
e7f9486
debug test
tommykw Sep 8, 2020
4088e99
debug test
tommykw Sep 8, 2020
b41dc57
debug test
tommykw Sep 8, 2020
915f0a6
debug test
tommykw Sep 9, 2020
fa92e31
debug test
tommykw Sep 9, 2020
0b8efe8
debug test
tommykw Sep 9, 2020
cb083d6
debug test
tommykw Sep 9, 2020
5a6d08e
debug test
tommykw Sep 9, 2020
040c40b
debug test
tommykw Sep 9, 2020
e7de4ab
debug test
tommykw Sep 9, 2020
a591650
debug test
tommykw Sep 9, 2020
baf75d9
debug test
tommykw Sep 9, 2020
cde0f3a
debug test
tommykw Sep 9, 2020
02f9053
debug test
tommykw Sep 9, 2020
ff0f97b
debug test
tommykw Sep 9, 2020
d1efc9b
debug test
tommykw Sep 9, 2020
1c51972
debug test
tommykw Sep 9, 2020
583a91e
debug test
tommykw Sep 9, 2020
52bee8f
debug test
tommykw Sep 9, 2020
9f8071b
debug test
tommykw Sep 9, 2020
8b0acc9
debug test
tommykw Sep 9, 2020
fa0df7a
debug test
tommykw Sep 9, 2020
03a6364
debug test
tommykw Sep 9, 2020
94d8a7f
debug test
tommykw Sep 9, 2020
6af6038
debug test
tommykw Sep 9, 2020
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
10 changes: 1 addition & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@ on: # rebuild any PRs and main branch changes

jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
npm install
- run: |
npm run all
test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
with:
milliseconds: 1000
github_token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ name: 'Your name here'
description: 'Provide a description here'
author: 'Your name or organization here'
inputs:
milliseconds: # change this
github_token:
required: true
description: 'input description here'
default: 'default value if applicable'
description: 'GitHub token'
runs:
using: 'node12'
main: 'dist/index.js'
5,703 changes: 5,589 additions & 114 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

558 changes: 558 additions & 0 deletions dist/licenses.txt

Large diffs are not rendered by default.

156 changes: 151 additions & 5 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"author": "",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.5"
"@actions/core": "^1.2.5",
"@actions/github": "^4.0.0"
},
"devDependencies": {
"@types/jest": "^26.0.10",
Expand Down
51 changes: 44 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
import * as core from '@actions/core'
import {wait} from './wait'
import * as github from '@actions/github'

async function run(): Promise<void> {
const octokit = github.getOctokit(core.getInput('github_token'))

try {
const ms: string = core.getInput('milliseconds')
core.debug(`Waiting ${ms} milliseconds ...`) // debug is only output if you set the secret `ACTIONS_RUNNER_DEBUG` to true
const {data: pullRequests} = await octokit.pulls.list({
...github.context.repo,
state: 'open'
})

for (const pr of pullRequests) {
if (pr.draft) {
continue
}

if (pr.requested_reviewers.length === 0) {
continue
}

const currentTime = new Date().getTime()
const pullRequestCreatedTime =
new Date(pr.created_at).getTime() + 60 * 60 * 24

if (currentTime > pullRequestCreatedTime) {
continue
}

//

const {data: pullRequest} = await octokit.pulls.get({
...github.context.repo,
pull_number: pr.number
})

if (pullRequest.review_comments !== 0) {
continue
}

core.debug(new Date().toTimeString())
await wait(parseInt(ms, 10))
core.debug(new Date().toTimeString())
const reviewers = pullRequest.requested_reviewers
.map(rr => `@${rr.login}`)
.join(', ')

core.setOutput('time', new Date().toTimeString())
await octokit.issues.createComment({
...github.context.repo,
issue_number: pullRequest.number,
body: `${reviewers} \nレビュー開始から1営業日経過しました。レビューをなるべく優先しましょう。`
})
}
} catch (error) {
core.setFailed(error.message)
}
Expand Down