Compare commits

..

16 commits
v3.0.3 ... main

Author SHA1 Message Date
Copilot
ae583cebed
feat: embed file content in message template via {path} placeholder (#1665)
Some checks are pending
Test / test (push) Waiting to run
* Initial plan

* Add prefix and suffix inputs to wrap comment body

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* feat: support combining path and message inputs using $path placeholder

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* feat: use {path} placeholder and remove prefix/suffix inputs

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* feat: rename placeholder from {path} to {{{content}}}

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/72744cd4-264e-4c06-95d4-6fdec3446f90

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* fix: when message has no {{{content}}} placeholder, return message as-is

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/b6492aa3-c55c-41f7-b43e-12cc3f2c3002

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* refactor: simplify {{{content}}} replacement — drop includes guard and regex

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/81112a7b-0e6d-4f21-ad36-530af7c0259f

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

* chore: remove accidentally committed dist/src/* and add to .gitignore

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/7ced80dd-92a9-46ad-b667-bf5ceaa129ea

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
2026-04-24 21:37:42 +09:00
dependabot[bot]
64ebf23022
build(deps-dev): Bump @biomejs/biome from 2.4.12 to 2.4.13 (#1693)
* build(deps-dev): Bump @biomejs/biome from 2.4.12 to 2.4.13

Bumps [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) from 2.4.12 to 2.4.13.
- [Release notes](https://github.com/biomejs/biome/releases)
- [Changelog](https://github.com/biomejs/biome/blob/main/packages/@biomejs/biome/CHANGELOG.md)
- [Commits](https://github.com/biomejs/biome/commits/@biomejs/biome@2.4.13/packages/@biomejs/biome)

---
updated-dependencies:
- dependency-name: "@biomejs/biome"
  dependency-version: 2.4.13
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps-dev): update biome config schema to 2.4.13

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/0e785994-e7ec-4db3-8a22-fde5f916b8a2

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
2026-04-24 20:56:04 +09:00
dependabot[bot]
4aa7401fe7
build(deps): Bump @actions/github from 9.1.0 to 9.1.1 (#1691)
Some checks are pending
Test / test (push) Waiting to run
Bumps [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github) from 9.1.0 to 9.1.1.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

---
updated-dependencies:
- dependency-name: "@actions/github"
  dependency-version: 9.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-24 14:40:56 +09:00
dependabot[bot]
8b12ac0bc7
build(deps): Bump @actions/core from 3.0.0 to 3.0.1 (#1690)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 3.0.0 to 3.0.1.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-version: 3.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-24 14:26:40 +09:00
dependabot[bot]
6933bae077
build(deps): Bump @actions/glob from 0.6.1 to 0.7.0 (#1689)
Bumps [@actions/glob](https://github.com/actions/toolkit/tree/HEAD/packages/glob) from 0.6.1 to 0.7.0.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/glob/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/glob)

---
updated-dependencies:
- dependency-name: "@actions/glob"
  dependency-version: 0.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-24 14:26:30 +09:00
dependabot[bot]
9d7bda1a6d
build(deps-dev): Bump vitest from 4.1.4 to 4.1.5 (#1688)
Some checks failed
Test / test (push) Has been cancelled
Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 4.1.4 to 4.1.5.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.5/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-version: 4.1.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-22 14:38:25 +09:00
dependabot[bot]
ac6d945897
build(deps-dev): Bump @biomejs/biome from 2.4.11 to 2.4.12 (#1685)
Some checks are pending
Test / test (push) Waiting to run
* build(deps-dev): Bump @biomejs/biome from 2.4.11 to 2.4.12

Bumps [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) from 2.4.11 to 2.4.12.
- [Release notes](https://github.com/biomejs/biome/releases)
- [Changelog](https://github.com/biomejs/biome/blob/main/packages/@biomejs/biome/CHANGELOG.md)
- [Commits](https://github.com/biomejs/biome/commits/@biomejs/biome@2.4.12/packages/@biomejs/biome)

---
updated-dependencies:
- dependency-name: "@biomejs/biome"
  dependency-version: 2.4.12
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps-dev): update biome.json schema to 2.4.12

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/8669ac78-b2d6-4649-a09c-132358f80309

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
2026-04-21 18:33:34 +09:00
dependabot[bot]
136562024a
build(deps-dev): Bump typescript from 6.0.2 to 6.0.3 (#1686)
Bumps [typescript](https://github.com/microsoft/TypeScript) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Commits](https://github.com/microsoft/TypeScript/compare/v6.0.2...v6.0.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 6.0.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-21 18:33:13 +09:00
dependabot[bot]
b3fac8ac2f
build(deps-dev): Bump rollup from 4.60.1 to 4.60.2 (#1687)
Bumps [rollup](https://github.com/rollup/rollup) from 4.60.1 to 4.60.2.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.60.1...v4.60.2)

---
updated-dependencies:
- dependency-name: rollup
  dependency-version: 4.60.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-21 18:29:19 +09:00
marocchino
0ea0beb66e
📦️ Build
Some checks failed
Test / test (push) Has been cancelled
2026-04-11 08:55:15 +09:00
dependabot[bot]
df6c1bd759
build(deps-dev): Bump @biomejs/biome from 2.4.10 to 2.4.11 (#1681)
* build(deps-dev): Bump @biomejs/biome from 2.4.10 to 2.4.11

Bumps [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) from 2.4.10 to 2.4.11.
- [Release notes](https://github.com/biomejs/biome/releases)
- [Changelog](https://github.com/biomejs/biome/blob/main/packages/@biomejs/biome/CHANGELOG.md)
- [Commits](https://github.com/biomejs/biome/commits/@biomejs/biome@2.4.11/packages/@biomejs/biome)

---
updated-dependencies:
- dependency-name: "@biomejs/biome"
  dependency-version: 2.4.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* build: update biome.json schema to 2.4.11

Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/f6a9d84c-09bc-4a86-9005-4600dbe7349c

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
2026-04-11 08:50:09 +09:00
dependabot[bot]
3ad213f54e
build(deps-dev): Bump vitest from 4.1.3 to 4.1.4 (#1682)
Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 4.1.3 to 4.1.4.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.4/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-version: 4.1.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-11 08:46:53 +09:00
dependabot[bot]
58072e51b1
build(deps): Bump @actions/github from 9.0.0 to 9.1.0 (#1683)
Bumps [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github) from 9.0.0 to 9.1.0.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

---
updated-dependencies:
- dependency-name: "@actions/github"
  dependency-version: 9.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-11 08:46:44 +09:00
dependabot[bot]
313a9382f7
build(deps-dev): Bump @types/node from 25.5.2 to 25.6.0 (#1684)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.5.2 to 25.6.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 25.6.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-11 08:46:29 +09:00
dependabot[bot]
159c67730e
build(deps-dev): Bump vitest from 4.1.2 to 4.1.3 (#1680)
Some checks failed
Test / test (push) Has been cancelled
Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.3/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-version: 4.1.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-08 11:50:20 +09:00
dependabot[bot]
b37c1a1c07
build(deps-dev): Bump vite from 8.0.3 to 8.0.5 (#1679)
Some checks are pending
Test / test (push) Waiting to run
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.0.3 to 8.0.5.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.5/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.0.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 22:11:03 +09:00
10 changed files with 464 additions and 390 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
__tests__/runner/*
lib/*
dist/src/
rollup.config.js
# ^^^ compiled output of rollup.config.ts (generated by --configPlugin at build time)
# comment out in distribution branches

View file

@ -112,6 +112,22 @@ with:
path: path-to-comment-contents.txt
```
### Embed file content inside a message template
Use `{{{content}}}` as a placeholder in the `message` to insert file content at that position.
````yaml
- name: Run Test
run: rake test > result.txt
- uses: marocchino/sticky-pull-request-comment@v3
with:
path: result.txt
message: |
```
{{{content}}}
```
````
### Delete the previous comment and add a comment at the end
```yaml
@ -220,11 +236,11 @@ For more detailed information about permissions, you can read from the link belo
### `message`
**Optional** Comment message
**Optional** Comment message. When used together with `path`, use `{{{content}}}` as a placeholder in the message where the file content should be inserted.
### `path`
**Optional** Path to file containing comment message
**Optional** Path to file containing comment message. When `message` is also provided and contains `{{{content}}}`, the file content is embedded at that placeholder position.
### `number`

View file

@ -210,4 +210,61 @@ describe("getBody", () => {
expect(await config.getBody()).toBe("")
expect(core.setFailed).toHaveBeenCalledWith("glob error")
})
test("embeds file content in message when {{{content}}} placeholder is used", async () => {
const {config, core} = await loadConfig()
vi.mocked(core.getMultilineInput).mockReturnValue(["__tests__/assets/result"])
vi.mocked(core.getInput).mockImplementation(name => {
if (name === "message") return "```\n{{{content}}}\n```"
return ""
})
mockGlobCreate.mockResolvedValue({
glob: vi.fn().mockResolvedValue([resolve("__tests__/assets/result")]),
})
expect(await config.getBody()).toBe("```\nhi there\n\n```")
})
test("replaces {{{content}}} in message with file content", async () => {
const {config, core} = await loadConfig()
vi.mocked(core.getMultilineInput).mockReturnValue(["__tests__/assets/result"])
vi.mocked(core.getInput).mockImplementation(name => {
if (name === "message") return "{{{content}}}\n---\n{{{content}}}"
return ""
})
mockGlobCreate.mockResolvedValue({
glob: vi.fn().mockResolvedValue([resolve("__tests__/assets/result")]),
})
expect(await config.getBody()).toBe("hi there\n\n---\n{{{content}}}")
})
test("uses message as body when path is provided but message has no {{{content}}} placeholder", async () => {
const {config, core} = await loadConfig()
vi.mocked(core.getMultilineInput).mockReturnValue(["__tests__/assets/result"])
vi.mocked(core.getInput).mockImplementation(name => {
if (name === "message") return "no placeholder here"
return ""
})
mockGlobCreate.mockResolvedValue({
glob: vi.fn().mockResolvedValue([resolve("__tests__/assets/result")]),
})
expect(await config.getBody()).toBe("no placeholder here")
})
test("embeds multiple files content in message when {{{content}}} placeholder is used", async () => {
const {config, core} = await loadConfig()
vi.mocked(core.getMultilineInput).mockReturnValue(["__tests__/assets/*"])
vi.mocked(core.getInput).mockImplementation(name => {
if (name === "message") return "```\n{{{content}}}\n```"
return ""
})
mockGlobCreate.mockResolvedValue({
glob: vi
.fn()
.mockResolvedValue([
resolve("__tests__/assets/result"),
resolve("__tests__/assets/result2"),
]),
})
expect(await config.getBody()).toBe("```\nhi there\n\nhey there\n\n```")
})
})

View file

@ -52,10 +52,10 @@ inputs:
default: "OUTDATED"
required: false
message:
description: "comment message"
description: "comment message. When used together with path, use `{{{content}}}` as a placeholder in the message where the file content should be inserted."
required: false
path:
description: "glob path to file(s) containing comment message"
description: "glob path to file(s) containing comment message. When message is also provided and contains `{{{content}}}`, the file content is embedded at that placeholder position."
required: false
ignore_empty:
description: "Indicates whether to ignore missing or empty messages"

View file

@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.10/schema.json",
"$schema": "https://biomejs.dev/schemas/2.4.13/schema.json",
"files": {
"includes": ["src/**/*.ts"]
},

18
dist/index.js generated vendored
View file

@ -29150,6 +29150,19 @@ function getProxyFetch(destinationUrl) {
function getApiBaseUrl() {
return process.env['GITHUB_API_URL'] || 'https://api.github.com';
}
function getUserAgentWithOrchestrationId(baseUserAgent) {
var _a;
const orchId = (_a = process.env['ACTIONS_ORCHESTRATION_ID']) === null || _a === void 0 ? void 0 : _a.trim();
if (orchId) {
const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
const tag = `actions_orchestration_id/${sanitizedId}`;
if (baseUserAgent === null || baseUserAgent === void 0 ? void 0 : baseUserAgent.includes(tag))
return baseUserAgent;
const ua = baseUserAgent ? `${baseUserAgent} ` : '';
return `${ua}${tag}`;
}
return baseUserAgent;
}
function getUserAgent() {
if (typeof navigator === "object" && "userAgent" in navigator) {
@ -33068,6 +33081,11 @@ function getOctokitOptions(token, options) {
if (auth) {
opts.auth = auth;
}
// Orchestration ID
const userAgent = getUserAgentWithOrchestrationId(opts.userAgent);
if (userAgent) {
opts.userAgent = userAgent;
}
return opts;
}

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

719
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "sticky-pull-request-comment",
"version": "3.0.3",
"version": "3.0.4",
"private": true,
"description": "Create comment on pull request, if exists update that comment.",
"main": "lib/main.js",
@ -29,21 +29,21 @@
"author": "marocchino",
"license": "MIT",
"dependencies": {
"@actions/core": "^3.0.0",
"@actions/github": "^9.0.0",
"@actions/glob": "^0.6.1",
"@actions/core": "^3.0.1",
"@actions/github": "^9.1.1",
"@actions/glob": "^0.7.0",
"@octokit/graphql-schema": "^15.26.1"
},
"devDependencies": {
"@biomejs/biome": "2.4.10",
"@biomejs/biome": "2.4.13",
"@rollup/plugin-commonjs": "^29.0.2",
"@rollup/plugin-node-resolve": "^16.0.3",
"@rollup/plugin-typescript": "^12.3.0",
"@types/node": "^25.5.2",
"@types/node": "^25.6.0",
"js-yaml": "^4.1.0",
"rimraf": "^6.1.3",
"rollup": "^4.60.1",
"typescript": "^6.0.2",
"vitest": "^4.1.2"
"rollup": "^4.60.2",
"typescript": "^6.0.3",
"vitest": "^4.1.5"
}
}

View file

@ -50,20 +50,27 @@ export async function getBody(): Promise<string> {
const followSymbolicLinks = core.getBooleanInput("follow_symbolic_links", {
required: true,
})
const messageInput = core.getInput("message", {required: false})
if (pathInput && pathInput.length > 0) {
try {
const globber = await create(pathInput.join("\n"), {
followSymbolicLinks,
matchDirectories: false,
})
return (await globber.glob()).map(path => readFileSync(path, "utf-8")).join("\n")
const fileContent = (await globber.glob())
.map(path => readFileSync(path, "utf-8"))
.join("\n")
if (messageInput) {
return messageInput.replace("{{{content}}}", fileContent)
}
return fileContent
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message)
}
return ""
}
} else {
return core.getInput("message", {required: false})
}
return messageInput
}