Skip to content

Commit

Permalink
Update main.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
clicketyclackety authored Feb 24, 2022
1 parent fed69fa commit efd2ce6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 24,19 @@ async function toDraft(id: string): Promise<void> {

async function run(): Promise<void> {
try {
const daysBeforeConvert = parseInt(
core.getInput('days-before-convert-draft', {required: true})
const prKey = (
core.getInput('pr-key', {required: true})
)
core.info('fetching all open pull requests')
core.info('fetching all open pull requests until I figure out how to get by ID')
const pullRequests = await octokit.paginate(octokit.rest.pulls.list, {
...github.context.repo,
state: 'open',
per_page: 100
})
core.info(`open pr count: ${pullRequests.length}`)
core.info(`pr key: ${pullRequests.length}`)

for (const pr of pullRequests) {
if (!pr.draft && shouldConvertToDraft(pr.updated_at, daysBeforeConvert)) {
if (!pr.draft && pr.key != prKey)) {
await toDraft(pr.node_id)
core.info(
`pr converted to draft: ${pr.number} ${pr.title}, last activity time ${pr.updated_at}`
Expand Down

0 comments on commit efd2ce6

Please sign in to comment.