4 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] 8f487347ab fix: suppress circular dependency warnings from node_modules in rollup config
Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/d06505e0-ed2a-4dff-841c-baf27a74d54e

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
2026-04-05 07:40:37 +00:00
copilot-swe-agent[bot] 6e06a5b4b9 fix: add context: globalThis to rollup config to suppress this-is-undefined warning
Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/d06505e0-ed2a-4dff-841c-baf27a74d54e

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
2026-04-05 07:38:22 +00:00
copilot-swe-agent[bot] c4fbe28317 fix: add rootDir and types to tsconfig.json to resolve TS5011 build error
Agent-Logs-Url: https://github.com/marocchino/sticky-pull-request-comment/sessions/c726777d-ddec-4ced-8af3-0bafb048ce2f

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
2026-04-05 07:34:20 +00:00
dependabot[bot] 6ef1707d4b build(deps-dev): Bump typescript from 5.9.3 to 6.0.2
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.9.3 to 6.0.2.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.9.3...v6.0.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 6.0.2
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-05 16:31:50 +09:00
13 changed files with 1774 additions and 2886 deletions
+49
View File
@@ -0,0 +1,49 @@
name: Test
on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- run: npm ci
- run: |
set -o pipefail
mkdir -p ./pr
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "all_result<<$EOF" >> "$GITHUB_ENV"
npm run all >> "$GITHUB_ENV" 2>&1 || true # proceed even if npm run all fails
echo >> "$GITHUB_ENV" # npm run all doesn't necessarily produce a newline
echo "$EOF" >> "$GITHUB_ENV"
id: all
- uses: ./
if: ${{ github.event_name == 'pull_request' }}
with:
header: All
message: |
<details open>
<summary>Output of npm run all</summary>
```shell
${{ env.all_result }}
```
</details>
- uses: ./
if: ${{ github.event_name == 'pull_request' }}
with:
header: All
append: true
hide_details: true
message: |
The build is over.
- name: Lint
run: npm run lint
- name: Format Check
run: npm run format-check
-1
View File
@@ -1,7 +1,6 @@
__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
+2 -18
View File
@@ -112,22 +112,6 @@ 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
@@ -236,11 +220,11 @@ For more detailed information about permissions, you can read from the link belo
### `message`
**Optional** Comment message. When used together with `path`, use `{{{content}}}` as a placeholder in the message where the file content should be inserted.
**Optional** Comment message
### `path`
**Optional** Path to file containing comment message. When `message` is also provided and contains `{{{content}}}`, the file content is embedded at that placeholder position.
**Optional** Path to file containing comment message
### `number`
-57
View File
@@ -210,61 +210,4 @@ 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```")
})
})
+2 -2
View File
@@ -52,10 +52,10 @@ inputs:
default: "OUTDATED"
required: false
message:
description: "comment message. When used together with path, use `{{{content}}}` as a placeholder in the message where the file content should be inserted."
description: "comment message"
required: false
path:
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."
description: "glob path to file(s) containing comment message"
required: false
ignore_empty:
description: "Indicates whether to ignore missing or empty messages"
+1 -1
View File
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.14/schema.json",
"$schema": "https://biomejs.dev/schemas/2.4.10/schema.json",
"files": {
"includes": ["src/**/*.ts"]
},
Generated Vendored
+1326 -2437
View File
File diff suppressed because it is too large Load Diff
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+372 -347
View File
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "sticky-pull-request-comment",
"version": "3.0.4",
"version": "3.0.1",
"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.1",
"@actions/github": "^9.1.1",
"@actions/glob": "^0.7.0",
"@actions/core": "^3.0.0",
"@actions/github": "^9.0.0",
"@actions/glob": "^0.6.1",
"@octokit/graphql-schema": "^15.26.1"
},
"devDependencies": {
"@biomejs/biome": "2.4.14",
"@biomejs/biome": "2.4.10",
"@rollup/plugin-commonjs": "^29.0.2",
"@rollup/plugin-node-resolve": "^16.0.3",
"@rollup/plugin-typescript": "^12.3.0",
"@types/node": "^25.6.2",
"@types/node": "^25.5.2",
"js-yaml": "^4.1.0",
"rimraf": "^6.1.3",
"rollup": "^4.60.3",
"typescript": "^6.0.3",
"vitest": "^4.1.5"
"rollup": "^4.60.1",
"typescript": "^6.0.2",
"vitest": "^4.1.2"
}
}
+6
View File
@@ -7,6 +7,12 @@ import typescript from "@rollup/plugin-typescript"
const config = {
context: "globalThis",
input: "src/main.ts",
onwarn: (warning, warn) => {
if (warning.code === "CIRCULAR_DEPENDENCY" && warning.ids?.every(id => id.includes("/node_modules/"))) {
return
}
warn(warning)
},
output: {
exports: "auto",
file: "dist/index.js",
+3 -10
View File
@@ -50,27 +50,20 @@ 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,
})
const fileContent = (await globber.glob())
.map(path => readFileSync(path, "utf-8"))
.join("\n")
if (messageInput) {
return messageInput.replace("{{{content}}}", fileContent)
}
return fileContent
return (await globber.glob()).map(path => readFileSync(path, "utf-8")).join("\n")
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message)
}
return ""
}
} else {
return core.getInput("message", {required: false})
}
return messageInput
}
+3 -3
View File
@@ -15,13 +15,13 @@
"noUnusedLocals": true,
"noUnusedParameters": false,
"outDir": "./dist",
"rootDir": "./src",
"types": ["node"],
"pretty": true,
"resolveJsonModule": true,
"rootDir": "./src",
"strict": true,
"strictNullChecks": true,
"target": "ES2022",
"types": ["node"]
"target": "ES2022"
},
"exclude": ["node_modules", "**/*.test.ts", "dist"],
"include": ["src"]