Skip to content

Commit c3ef847

Browse files
committed
Add a test script to help debugging /open pr
The recent attempt at opening PRs for OpenSSL at git-for-windows/git#4273 (comment) failed to produce the correct `version` parameter: instead of the desired `1.1.1t` it came up with `1.1_1t` (i.e. only the first underscore was converted to a dot). To help with debugging such issues, let's add a script that allows for reproducing the functionality locally: ./test-open-pr.js <url-to-issue> will output the package name and the version that was determined from that ticket. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 4a4dbe1 commit c3ef847

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

test-open-pr.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env node
2+
3+
(async () => {
4+
// Expect a URL
5+
const url = process.argv[2]
6+
const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)\/?$/)
7+
if (!match) throw new Error(`Unhandled URL: ${url}`)
8+
const [, owner, repo, number ] = match
9+
10+
const githubApiRequest = require('./GitForWindowsHelper/github-api-request')
11+
const { title, body } = await githubApiRequest(
12+
console,
13+
null,
14+
'GET',
15+
`/repos/${owner}/${repo}/issues/${number}`
16+
)
17+
18+
const { guessComponentUpdateDetails } = require('./GitForWindowsHelper/component-updates')
19+
const details = await guessComponentUpdateDetails(title, body)
20+
console.log(details)
21+
})().catch(console.log)

0 commit comments

Comments
 (0)