Skip to content

Commit

Permalink
Merge pull request #31 from staabm/patch-2
Browse files Browse the repository at this point in the history
Added botComments input
  • Loading branch information
agneym authored Jul 7, 2022
2 parents 4270f2e + 7cc814a commit ae445fe
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ Works only with Pull Requests and `md` and `mdx` files.

These are props that you can configure in the action file to customise the working.

| Props | Description | Required |
| ------------ | :--------------------------------------: | :------: |
| path | Path to place the image URL in | true |
| commitMsg | Commit message when image is added | |
| background | Background color, gradient or image url | |
| fontColor | any css supported color | |
| fontSize | the font size | |
| componentUrl | Web Component to be rendered for output. | |
| Props | Description | Required |
| ------------ | :-----------------------------------------------------: | :------: |
| path | Path to place the image URL in | true |
| commitMsg | Commit message when image is added | |
| background | Background color, gradient or image url | |
| fontColor | any css supported color | |
| fontSize | the font size | |
| componentUrl | Web Component to be rendered for output. | |
| botComments | Whether a comment with a preview image should be posted |

Frontmatter level props on a document always takes precedence over Repository level props.

Expand Down Expand Up @@ -106,6 +107,10 @@ Frontmatter level props on a document always takes precedence over Repository le
5. **I need to format the title**

The `title` prop supports markdown, feel _free_ to _use_ it.

6. **I don't want these preview image bot comments**

the `botComments` repo prop should be set to `"no"`

### I need more customisation on the output.

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ inputs:
height:
description: "Height of the screen"
default: "630"
botComments:
description: "Whether a comment with a preview image should be posted"
default: "yes"
runs:
using: "docker"
image: "Dockerfile"
10 changes: 6 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ async function run() {

commitFile(image, repoProps, property.filename);

const markdown = commentMarkdown(
`${repoProps.assetPath}${property.filename}`
);
await createComment(markdown);
if (repoProps.botComments != "no") {
const markdown = commentMarkdown(
`${repoProps.assetPath}${property.filename}`
);
await createComment(markdown);
}
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/repo-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ async function getRepoProps() {
const fontSize = getInput("fontSize");
const width = getInput("width");
const height = getInput("height");
const botComments = getInput("botComments");
return {
assetPath,
componentUrl,
Expand All @@ -20,7 +21,8 @@ async function getRepoProps() {
fontColor,
fontSize,
width,
height
height,
botComments
};
}

Expand Down

0 comments on commit ae445fe

Please sign in to comment.