Skip to content

Commit 4f9d90d

Browse files
jasonkarnsmislav
andauthored
Print formula bump PR in Job Summary (#267)
Co-authored-by: Mislav Marohnić <[email protected]>
1 parent 93ae4fe commit 4f9d90d

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/edit-github-blob.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export type Options = {
2929
owner: string
3030
repo: string
3131
filePath: string
32+
formulaName?: string
33+
version?: string
3234
branch?: string
3335
apiClient: API
3436
replace: (oldContent: string) => string

src/main-test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,7 @@ test('prepareEdit() non-homebrew-core', async (t) => {
126126
t.is(opts.repo, 'homebrew-utils')
127127
t.is(opts.branch, '')
128128
t.is(opts.filePath, 'Formula/repo.rb')
129+
t.is(opts.formulaName, 'repo')
130+
t.is(opts.version, '0.8.2')
129131
t.is(opts.commitMessage, 'Upgrade repo to 0.8.2')
130132
})

src/main.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getInput, getBooleanInput } from '@actions/core'
1+
import { getInput, getBooleanInput, summary } from '@actions/core'
22
import type { API } from './api.js'
33
import editGitHubBlob from './edit-github-blob.js'
44
import { Options as EditOptions } from './edit-github-blob.js'
@@ -52,6 +52,14 @@ export default async function (api: (token: string) => API): Promise<void> {
5252
)
5353
const createdUrl = await editGitHubBlob(options)
5454
console.log(createdUrl)
55+
56+
if (options.formulaName && options.version) {
57+
summary.addHeading('Bump Homebrew formula')
58+
summary.addRaw(`🍺 Bumped ${options.formulaName} to ${options.version} `)
59+
summary.addLink(createdUrl, createdUrl)
60+
summary.addEOL()
61+
summary.write()
62+
}
5563
}
5664

5765
type Context = {
@@ -154,6 +162,8 @@ export async function prepareEdit(
154162
repo,
155163
branch,
156164
filePath,
165+
formulaName,
166+
version,
157167
commitMessage,
158168
pushTo,
159169
makePR,

0 commit comments

Comments
 (0)