Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 2x 2x 2x 8x 8x 7x 8x 8x 4x 4x 4x | /** Default header part of the comment */
export const COMMENT_DEFAULT_HEAD = `## ⚡ Preview deployments
| Project | Previews |
| :----------- | :---------- |`
interface Line {
name: string
url: string
}
export const COMMENT_FOOTER =
'<sub>With ♡ by [generate-preview-deployments](https://github.com/marketplace/actions/generate-preview-deployments).</sub>'
export default class Comment {
private body: string
constructor(header: string = COMMENT_DEFAULT_HEAD) {
this.body = header
return this
}
public getBody(): string {
return `${this.body}
${COMMENT_FOOTER}`
}
public appendLine(line: Line) {
this.body += `\n| ${line.name} | ${line.url} |`
return this
}
public addTimestamp() {
const date = new Date()
this.body += `\n\n> Previews generated at ${date.toLocaleString()}`
return this
}
}
|