Skip to content

Commit

Permalink
fix dangling prs script (#53859)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachmari authored Jan 10, 2025
1 parent f301f9a commit 4affc52
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/workflows/close-dangling-prs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { program, Option } from 'commander'

import github from './github.js'
import { getActionContext } from './action-context.js'
import { octoSecondaryRatelimitRetry } from './secondary-ratelimit-retry'

const DRY_RUN = process.env.DRY_RUN || 'false'
Expand Down Expand Up @@ -32,19 +31,13 @@ const CONFIGS: Config[] = [
},
]

let owner = 'github'
let repo = 'docs-internal'

if (process.env.GITHUB_EVENT_PATH) {
const actionContext = getActionContext()
owner = actionContext.owner
repo = actionContext.repo
}
const owner = process.env.GITHUB_REPOSITORY_OWNER || 'github'
const repo = process.env.GITHUB_REPOSITORY?.split('/')[1] || 'docs-internal'

program
.description('Finds PRs with "FOR PREVIEW ONLY" in the title that are too old and closes them.')
.option('owner', 'Owner of the repository', owner)
.option('repo', 'Name of the repository', repo)
.option('--owner', 'Owner of the repository', owner)
.option('--repo', 'Name of the repository', repo)
.addOption(
new Option(
'--dry-run',
Expand Down

0 comments on commit 4affc52

Please sign in to comment.