Skip to content

Commit ddb77f6

Browse files
committed
open-pr: be more lenient when looking for the component-update ticket
When opening a Pull Request, we would like to automatically close the corresponding `component-update` ticket, if there is any. Unfortunately, it is not _quite_ trivial to search for such tickets. One frustrating aspect is that some updates have the version number prefixed with `v` while others do not. And the search on GitHub is a bit strict about that: if you search for `0.10.1`, you won't find a ticket mentioning `v0.10.1` and the opposite is also true. We already started to special-case at least Git LFS, but it's a bit of a whack-a-mole to do that for all components we track in Git for Windows. Let's instead search for the version in both forms: both prefixed with `v` as well as without. This addresses git-for-windows/gfw-helper-github-app#18 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent a538b16 commit ddb77f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.github/workflows/open-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,15 @@ jobs:
180180
let body = ''
181181
try {
182182
const name = process.env.PACKAGE_TO_UPGRADE
183-
const version = `${name.match(/git-lfs/) ? 'v' : ''}${process.env.UPGRADE_TO_VERSION}`
183+
const version = process.env.UPGRADE_TO_VERSION
184184
185185
if (name === 'mintty') body = `See https://github.com/mintty/mintty/releases/tag/${version} for details.`
186186
else if (name === 'mingw-w64-git-lfs') body = `See https://github.com/git-lfs/git-lfs/releases/tag/${version} for details.`
187187
else if (name === 'mingw-w64-pcre2') body = `See https://github.com/PCRE2Project/pcre2/blob/pcre2-${version}/ChangeLog for details.`
188188
189189
const terms = 'type:issue repo:git-for-windows/git state:open author:app/github-actions label:component-update'
190190
const { data } = await github.rest.search.issuesAndPullRequests({
191-
q: `"[New ${name.replace(/^mingw-w64-/, '')} version]" ${version} in:title ${terms}`,
191+
q: `"[New ${name.replace(/^mingw-w64-/, '')} version]" (${version} OR v${version}) in:title ${terms}`,
192192
})
193193
if (data.total_count) body = `${body ? `${body}\n\n` : ''}This closes ${data.items[0].html_url}`
194194
} catch (e) {

0 commit comments

Comments
 (0)