Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/self-documenting-attachments-comment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@buildinternet/uploads": patch
---

Managed GitHub attachments comment now ends with a short "Add media" hint pointing readers at `uploads put <file> --pr <N> --comment` (or `--issue <N>`) and the docs, so anyone viewing the comment can learn how to contribute media themselves.
3 changes: 3 additions & 0 deletions apps/api/src/github-comment-render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,8 @@ export function attachmentsCommentBody(
lines.push(
'<sub>Maintained by <a href="https://uploads.sh">uploads.sh</a> — re-uploading a file with the same name updates it everywhere it is embedded.</sub>',
);
lines.push(
'<sub>Add media: <code>uploads put &lt;file&gt; --pr &lt;N&gt; --comment</code> (or <code>--issue &lt;N&gt;</code>) · <a href="https://uploads.sh/docs/github-app">docs</a></sub>',
);
return lines.join("\n");
}
3 changes: 3 additions & 0 deletions packages/uploads/src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,5 +306,8 @@ export function attachmentsCommentBody(
lines.push(
'<sub>Maintained by <a href="https://uploads.sh">uploads.sh</a> — re-uploading a file with the same name updates it everywhere it is embedded.</sub>',
);
lines.push(
'<sub>Add media: <code>uploads put &lt;file&gt; --pr &lt;N&gt; --comment</code> (or <code>--issue &lt;N&gt;</code>) · <a href="https://uploads.sh/docs/github-app">docs</a></sub>',
);
return lines.join("\n");
}
2 changes: 1 addition & 1 deletion test/fixtures/github-comment-golden-cap.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@
],
"galleries": [],
"marker": "<!-- uploads.sh:attachments ws=acme -->",
"expected": "<!-- uploads.sh:attachments ws=acme -->\n### 📎 Attachments\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img01.png\"><img width=\"400\" alt=\"img01.png\" src=\"https://embed.uploads.sh/f/img01.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img02.png\"><img width=\"400\" alt=\"img02.png\" src=\"https://embed.uploads.sh/f/img02.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img03.png\"><img width=\"400\" alt=\"img03.png\" src=\"https://embed.uploads.sh/f/img03.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img04.png\"><img width=\"400\" alt=\"img04.png\" src=\"https://embed.uploads.sh/f/img04.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img05.png\"><img width=\"400\" alt=\"img05.png\" src=\"https://embed.uploads.sh/f/img05.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img06.png\"><img width=\"400\" alt=\"img06.png\" src=\"https://embed.uploads.sh/f/img06.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img07.png\"><img width=\"400\" alt=\"img07.png\" src=\"https://embed.uploads.sh/f/img07.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img08.png\"><img width=\"400\" alt=\"img08.png\" src=\"https://embed.uploads.sh/f/img08.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img09.png\"><img width=\"400\" alt=\"img09.png\" src=\"https://embed.uploads.sh/f/img09.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img10.png\"><img width=\"400\" alt=\"img10.png\" src=\"https://embed.uploads.sh/f/img10.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img11.png\"><img width=\"400\" alt=\"img11.png\" src=\"https://embed.uploads.sh/f/img11.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img12.png\"><img width=\"400\" alt=\"img12.png\" src=\"https://embed.uploads.sh/f/img12.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img13.png\"><img width=\"400\" alt=\"img13.png\" src=\"https://embed.uploads.sh/f/img13.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img14.png\"><img width=\"400\" alt=\"img14.png\" src=\"https://embed.uploads.sh/f/img14.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img15.png\"><img width=\"400\" alt=\"img15.png\" src=\"https://embed.uploads.sh/f/img15.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img16.png\"><img width=\"400\" alt=\"img16.png\" src=\"https://embed.uploads.sh/f/img16.png\"></a>\n\n<details><summary>1 more attachment</summary>\n\n- [img17.png](https://uploads.sh/f/acme/gh/acme/web/pull/12/img17.png)\n\n</details>\n\n<sub>Maintained by <a href=\"https://uploads.sh\">uploads.sh</a> — re-uploading a file with the same name updates it everywhere it is embedded.</sub>"
"expected": "<!-- uploads.sh:attachments ws=acme -->\n### 📎 Attachments\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img01.png\"><img width=\"400\" alt=\"img01.png\" src=\"https://embed.uploads.sh/f/img01.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img02.png\"><img width=\"400\" alt=\"img02.png\" src=\"https://embed.uploads.sh/f/img02.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img03.png\"><img width=\"400\" alt=\"img03.png\" src=\"https://embed.uploads.sh/f/img03.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img04.png\"><img width=\"400\" alt=\"img04.png\" src=\"https://embed.uploads.sh/f/img04.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img05.png\"><img width=\"400\" alt=\"img05.png\" src=\"https://embed.uploads.sh/f/img05.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img06.png\"><img width=\"400\" alt=\"img06.png\" src=\"https://embed.uploads.sh/f/img06.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img07.png\"><img width=\"400\" alt=\"img07.png\" src=\"https://embed.uploads.sh/f/img07.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img08.png\"><img width=\"400\" alt=\"img08.png\" src=\"https://embed.uploads.sh/f/img08.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img09.png\"><img width=\"400\" alt=\"img09.png\" src=\"https://embed.uploads.sh/f/img09.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img10.png\"><img width=\"400\" alt=\"img10.png\" src=\"https://embed.uploads.sh/f/img10.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img11.png\"><img width=\"400\" alt=\"img11.png\" src=\"https://embed.uploads.sh/f/img11.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img12.png\"><img width=\"400\" alt=\"img12.png\" src=\"https://embed.uploads.sh/f/img12.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img13.png\"><img width=\"400\" alt=\"img13.png\" src=\"https://embed.uploads.sh/f/img13.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img14.png\"><img width=\"400\" alt=\"img14.png\" src=\"https://embed.uploads.sh/f/img14.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img15.png\"><img width=\"400\" alt=\"img15.png\" src=\"https://embed.uploads.sh/f/img15.png\"></a>\n\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/img16.png\"><img width=\"400\" alt=\"img16.png\" src=\"https://embed.uploads.sh/f/img16.png\"></a>\n\n<details><summary>1 more attachment</summary>\n\n- [img17.png](https://uploads.sh/f/acme/gh/acme/web/pull/12/img17.png)\n\n</details>\n\n<sub>Maintained by <a href=\"https://uploads.sh\">uploads.sh</a> — re-uploading a file with the same name updates it everywhere it is embedded.</sub>\n<sub>Add media: <code>uploads put &lt;file&gt; --pr &lt;N&gt; --comment</code> (or <code>--issue &lt;N&gt;</code>) · <a href=\"https://uploads.sh/docs/github-app\">docs</a></sub>"
}
2 changes: 1 addition & 1 deletion test/fixtures/github-comment-golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
]
}
],
"expected": "<!-- uploads.sh:attachments -->\n### 🖼️ Galleries\n\n#### <a href=\"https://uploads.sh/g/abc\">Design review</a>\n<a href=\"https://uploads.sh/g/abc/i1\"><img width=\"320\" alt=\"screen one\" src=\"https://embed.uploads.sh/g/abc/i1.png\"></a>\n<sub><a href=\"https://uploads.sh/g/abc\">Open gallery</a></sub>\n\n\n### 📎 Attachments\n\n- [build.log](https://uploads.sh/f/acme/gh/acme/web/pull/12/build.log)\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/hero.png\"><img width=\"400\" alt=\"hero.png\" src=\"https://embed.uploads.sh/f/hero.png\"></a>\n\n<sub>Maintained by <a href=\"https://uploads.sh\">uploads.sh</a> — re-uploading a file with the same name updates it everywhere it is embedded.</sub>"
"expected": "<!-- uploads.sh:attachments -->\n### 🖼️ Galleries\n\n#### <a href=\"https://uploads.sh/g/abc\">Design review</a>\n<a href=\"https://uploads.sh/g/abc/i1\"><img width=\"320\" alt=\"screen one\" src=\"https://embed.uploads.sh/g/abc/i1.png\"></a>\n<sub><a href=\"https://uploads.sh/g/abc\">Open gallery</a></sub>\n\n\n### 📎 Attachments\n\n- [build.log](https://uploads.sh/f/acme/gh/acme/web/pull/12/build.log)\n<a href=\"https://uploads.sh/f/acme/gh/acme/web/pull/12/hero.png\"><img width=\"400\" alt=\"hero.png\" src=\"https://embed.uploads.sh/f/hero.png\"></a>\n\n<sub>Maintained by <a href=\"https://uploads.sh\">uploads.sh</a> — re-uploading a file with the same name updates it everywhere it is embedded.</sub>\n<sub>Add media: <code>uploads put &lt;file&gt; --pr &lt;N&gt; --comment</code> (or <code>--issue &lt;N&gt;</code>) · <a href=\"https://uploads.sh/docs/github-app\">docs</a></sub>"
}
Loading