diff --git a/plugins/woocommerce-blocks/.github/comments-aggregator/README.md b/plugins/woocommerce-blocks/.github/comments-aggregator/README.md index f7b296b6060..667f6eef86f 100644 --- a/plugins/woocommerce-blocks/.github/comments-aggregator/README.md +++ b/plugins/woocommerce-blocks/.github/comments-aggregator/README.md @@ -28,7 +28,7 @@ This action is meant to be used as the poster/commenter. Instead of having exist - **`repo-token`** (required): This is the GitHub token. This is required to manipulate PR comments. - **`section-id`** (required): The unique ID that helps this action to update the correct part of the aggregated comment. -- **`content`** (required): The comment content. +- **`content`** (option): The comment content. Default to empty. If nothing was provided, this action will stop gracefully. - **`order`** (optional): The order of the comment part inside the aggregated comment. Default to 10. ## More examples diff --git a/plugins/woocommerce-blocks/.github/comments-aggregator/action.yml b/plugins/woocommerce-blocks/.github/comments-aggregator/action.yml index 495b9dd7eb2..e26a436f1e5 100644 --- a/plugins/woocommerce-blocks/.github/comments-aggregator/action.yml +++ b/plugins/woocommerce-blocks/.github/comments-aggregator/action.yml @@ -9,7 +9,7 @@ inputs: required: true content: description: 'Comment content' - required: true + default: '' order: description: 'Order of the comment' required: false diff --git a/plugins/woocommerce-blocks/.github/comments-aggregator/index.js b/plugins/woocommerce-blocks/.github/comments-aggregator/index.js index 6b2090095cd..5eb0b925b1e 100644 --- a/plugins/woocommerce-blocks/.github/comments-aggregator/index.js +++ b/plugins/woocommerce-blocks/.github/comments-aggregator/index.js @@ -16,12 +16,17 @@ const runner = async () => { const payload = context.payload; const repo = payload.repository.name; const owner = payload.repository.owner.login; + + // Only run this action on pull requests. + if ( ! payload.pull_request?.number ) { + return; + } + const sectionId = getInput( 'section-id', { required: true, } ); - const content = getInput( 'content', { - required: true, - } ); + + const content = getInput( 'content' ); const order = getInput( 'order' ); if ( ! sectionId || ! content ) { diff --git a/plugins/woocommerce-blocks/.github/comments-aggregator/utils.js b/plugins/woocommerce-blocks/.github/comments-aggregator/utils.js index 731c8f1ca4d..341830c90af 100644 --- a/plugins/woocommerce-blocks/.github/comments-aggregator/utils.js +++ b/plugins/woocommerce-blocks/.github/comments-aggregator/utils.js @@ -1,7 +1,7 @@ const identifier = ``; const separator = ''; const footerText = - '[comments-aggregator](https://github.com/woocommerce/woocommerce-blocks/tree/trunk/.github/comments-aggregator).'; + '[comments-aggregator](https://github.com/woocommerce/woocommerce-blocks/tree/trunk/.github/comments-aggregator)'; const footer = `\n> ${ footerText }\n${ identifier }`; function getSectionId( section ) {