Skip to content

Commit 6eab2c1

Browse files
committed
πŸ”¨ Fix guestbook comment replacement
1 parent 5266b84 commit 6eab2c1

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

β€Ž.github/workflows/main.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ jobs:
1717
issue: 1
1818
approvers: |
1919
joshmgross
20-
- run: cat README.md
21-
20+
guestbook-path: guestbook.md
2221
- name: Update guestbook
2322
run: |
2423
if [[ `git status --porcelain` ]]; then
2524
git config --local user.email "[email protected]"
2625
git config --local user.name "${{ github.actor }}"
27-
git add README.md
26+
git add guestbook.md
2827
git commit -m "✏ Update guestbook"
2928
git push
3029
fi

β€ŽREADME.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,14 @@ See [main.yml](.github/workflows/main.yml) for a full workflow file example.
3939
4040
In your guestbook markdown file, add comments to denote the start and end of the guestbook. Everything within these comments will be replaced by approved comments from the issue specified.
4141
```md
42-
[@joshmgross](https://github.com/joshmgross) said:
43-
> Hello, this is an informative and useful comment illustrating my thoughts. πŸ§€
44-
<sup>[src](https://github.com/joshmgross/guestbook/issues/1#issuecomment-645117859)</sup>
45-
```
42+
<!--START:guestbook-->
4643

47-
## Example Guestbook
44+
<!--END:guestbook-->
45+
```
4846

49-
This guestbook is populated by approved :+1: comments in https://github.com/joshmgross/guestbook/issues/1.
47+
# Example Guestbook
5048

51-
[@joshmgross](https://github.com/joshmgross) said:
52-
> Hello, this is an informative and useful comment illustrating my thoughts. πŸ§€
53-
<sup>[src](https://github.com/joshmgross/guestbook/issues/1#issuecomment-645117859)</sup>
49+
See [guestbook.md](./guestbook.md) for an example guestbook.
5450

5551
## Prior Art 🎨
5652

β€Ždist/book.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ function createGuestbookList(comments) {
4141
function generateGuestbook(path, comments) {
4242
const guestbook = getReadme(path);
4343
const guestbookList = createGuestbookList(comments);
44-
const updatedGuestbook = guestbook.replace(commentSectionRegex, guestbookList);
44+
const guestbookContent = `${startComment}\n${guestbookList}\n${endComment}`;
45+
const updatedGuestbook = guestbook.replace(commentSectionRegex, guestbookContent);
4546
writeReadme(path, updatedGuestbook);
4647
}
4748
exports.generateGuestbook = generateGuestbook;

β€Ždist/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9490,7 +9490,8 @@ function createGuestbookList(comments) {
94909490
function generateGuestbook(path, comments) {
94919491
const guestbook = getReadme(path);
94929492
const guestbookList = createGuestbookList(comments);
9493-
const updatedGuestbook = guestbook.replace(commentSectionRegex, guestbookList);
9493+
const guestbookContent = `${startComment}\n${guestbookList}\n${endComment}`;
9494+
const updatedGuestbook = guestbook.replace(commentSectionRegex, guestbookContent);
94949495
writeReadme(path, updatedGuestbook);
94959496
}
94969497
exports.generateGuestbook = generateGuestbook;

β€Žguestbook.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Example Guestbook
2+
3+
This guestbook is populated by approved :+1: comments in https://github.com/joshmgross/guestbook/issues/1.
4+
5+
<!--START:guestbook-->
6+
7+
<!--END:guestbook-->

β€Žsrc/book.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function createGuestbookList(comments: Comment[]): string {
2727
export function generateGuestbook(path: string, comments: Comment[]): void {
2828
const guestbook = getReadme(path);
2929
const guestbookList = createGuestbookList(comments);
30-
const updatedGuestbook = guestbook.replace(commentSectionRegex, guestbookList);
30+
const guestbookContent = `${startComment}\n${guestbookList}\n${endComment}`;
31+
const updatedGuestbook = guestbook.replace(commentSectionRegex, guestbookContent);
3132
writeReadme(path, updatedGuestbook);
3233
}

0 commit comments

Comments
Β (0)