Skip to content

Commit 4b988c4

Browse files
committed
Add support for the /synchronize-sdks command
This slash command will trigger the `sync` workflows in the Git SDK repositories, which updates them according to the Pacman repositories. This is particularly useful after deploying a package, to make sure that the next `git-artifacts` build will pick up the new package version. For convenience, there is also the `/sync` shortcut. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 2e733bd commit 4b988c4

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

GitForWindowsHelper/slash-commands.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,50 @@ module.exports = async (context, req) => {
529529
const answer2 = await appendToIssueComment(context, await getToken(), owner, repo, commentId, `The workflow run [was started](${answer.html_url})`)
530530
return `I edited the comment: ${answer2.html_url}`
531531
}
532+
533+
if (command === '/synchronize-sdks' || command === '/sync') {
534+
if (owner !== 'git-for-windows') {
535+
return `Ignoring ${command} in unexpected repo: ${commentURL}`
536+
}
537+
538+
await checkPermissions()
539+
540+
await thumbsUp()
541+
542+
const triggerWorkflowDispatch = require('./trigger-workflow-dispatch')
543+
const triggerSync = async (sdkRepo) =>
544+
await triggerWorkflowDispatch(
545+
context,
546+
await getToken('git-for-windows', sdkRepo),
547+
'git-for-windows',
548+
sdkRepo,
549+
'sync.yml',
550+
'main'
551+
)
552+
553+
const { appendToIssueComment } = require('./issues')
554+
const appendToComment = async (text) =>
555+
await appendToIssueComment(
556+
context,
557+
await getToken(),
558+
owner,
559+
repo,
560+
commentId,
561+
text
562+
)
563+
564+
for (const architecture of ['aarch64', 'x86_64', 'i686']) {
565+
const sdkRepo = {
566+
aarch64: 'git-sdk-arm64',
567+
x86_64: 'git-sdk-64',
568+
i686: 'git-sdk-32'
569+
}[architecture]
570+
const sync = await triggerSync(sdkRepo)
571+
commentURL = (await appendToComment(`The ['sync' run for ${architecture}](${sync.html_url}) was started.`)).html_url
572+
}
573+
574+
return `I edited the comment: ${commentURL}`
575+
}
532576
} catch (e) {
533577
await react('confused')
534578
throw e

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ For convenience, the command can be abbreviated as `/add relnote <type> <message
4545

4646
**What does it do?** This triggers one ore more [GitHub workflow runs](https://github.com/git-for-windows/git-for-windows-automation/actions/workflows/build-and-deploy.yml) to build and deploy Git for Windows' [Pacman packages](https://github.com/git-for-windows/git/wiki/Package-management).
4747

48+
### `/synchronize-sdks`
49+
50+
**Where can it be called?** In Issues and Pull Requests of Git for Windows' repositories.
51+
52+
**What does it do?** This triggers the `sync` GitHub workflow runs in Git for Windows' `git-sdk-*` repositories, i.e. updates them with the newest package versions as per the Pacman repositories.
53+
4854
### `/git-artifacts`
4955

5056
**Where can it be called?** In `git-for-windows/git`'s [Pull Requests](https://github.com/git-for-windows/git/pulls)

0 commit comments

Comments
 (0)