Skip to content

Commit

Permalink
Merge pull request #409 from thollander/fix/wrong-var-renaming
Browse files Browse the repository at this point in the history
fix: some wrong variables renaming
  • Loading branch information
thollander authored Nov 2, 2024
2 parents cb13519 + a11fbfe commit a38b001
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ You can either pass an absolute filePath or a relative one that will be by defau
- name: PR comment with file
uses: thollander/actions-comment-pull-request@v3
with:
filePath: /path/to/file.txt
file-path: /path/to/file.txt
```


Expand All @@ -57,7 +57,7 @@ It takes only valid reactions and adds it to the comment you've just created. (S

### Specifying which pull request to comment on

You can explicitly input which pull request should be commented on by passing the `pr_number` input.
You can explicitly input which pull request should be commented on by passing the `pr-number` input.
That is particularly useful for manual workflow for instance (`workflow_run`).

```yml
Expand All @@ -67,13 +67,13 @@ That is particularly useful for manual workflow for instance (`workflow_run`).
with:
message: |
Hello world ! :wave:
pr_number: 123 # This will comment on pull request #123
pr-number: 123 # This will comment on pull request #123
```


### Update a comment

Editing an existing comment is also possible thanks to the `comment_tag` input.
Editing an existing comment is also possible thanks to the `comment-tag` input.

Thanks to this parameter, it will be possible to identify your comment and then to upsert on it.
If the comment is not found at first, it will create a new comment.
Expand All @@ -87,28 +87,28 @@ _That is particularly interesting while committing multiple times in a PR and th
with:
message: |
_(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_
comment_tag: execution
comment-tag: execution
```

Note: the input `mode` can be used to either `upsert` (by default) or `recreate` the comment (= delete and create)

### Delete a comment


Deleting a comment with a specific `comment_tag` is possible with the `mode: delete`. If a comment with the `comment_tag` exists, it will be deleted when ran.
Deleting a comment with a specific `comment-tag` is possible with the `mode: delete`. If a comment with the `comment-tag` exists, it will be deleted when ran.

```yml
...
- name: Delete a comment
uses: thollander/actions-comment-pull-request@v3
with:
comment_tag: to_delete
comment-tag: to_delete
mode: delete
```

### Delete a comment on job completion

Deleting an existing comment on job completion is also possible thanks to the `comment_tag` input combined with `mode: delete-on-completion`.
Deleting an existing comment on job completion is also possible thanks to the `comment-tag` input combined with `mode: delete-on-completion`.

This will delete the comment at the end of the job.

Expand All @@ -119,7 +119,7 @@ This will delete the comment at the end of the job.
with:
message: |
The PR is being built...
comment_tag: to_delete_on_completion
comment-tag: to_delete_on_completion
mode: delete-on-completion
```

Expand Down
2 changes: 1 addition & 1 deletion lib/cleanup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9549,7 +9549,7 @@ async function run() {
return;
}
if (!commentTag) {
core.debug("No 'comment_tag' parameter passed in. Cannot search for something to delete.");
core.debug("No 'comment-tag' parameter passed in. Cannot search for something to delete.");
return;
}
const context = github.context;
Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9555,7 +9555,7 @@ async function run() {
const mode = core.getInput('mode');
const createIfNotExists = core.getInput('create-if-not-exists') === 'true';
if (!message && !filePath && mode !== 'delete') {
core.setFailed('Either "filePath" or "message" should be provided as input unless running as "delete".');
core.setFailed('Either "file-path" or "message" should be provided as input unless running as "delete".');
return;
}
let content = message;
Expand Down Expand Up @@ -9672,7 +9672,7 @@ async function run() {
core.info('No comment has been found with asked pattern. Creating a new comment.');
}
else {
core.info('Not creating comment as the pattern has not been found. Use `create_if_not_exists: true` to create a new comment anyway.');
core.info('Not creating comment as the pattern has not been found. Use `create-if-not-exists: true` to create a new comment anyway.');
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function run() {
}

if (!commentTag) {
core.debug("No 'comment_tag' parameter passed in. Cannot search for something to delete.");
core.debug("No 'comment-tag' parameter passed in. Cannot search for something to delete.");
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function run() {
const createIfNotExists: boolean = core.getInput('create-if-not-exists') === 'true';

if (!message && !filePath && mode !== 'delete') {
core.setFailed('Either "filePath" or "message" should be provided as input unless running as "delete".');
core.setFailed('Either "file-path" or "message" should be provided as input unless running as "delete".');
return;
}

Expand Down Expand Up @@ -176,7 +176,7 @@ async function run() {
core.info('No comment has been found with asked pattern. Creating a new comment.');
} else {
core.info(
'Not creating comment as the pattern has not been found. Use `create_if_not_exists: true` to create a new comment anyway.',
'Not creating comment as the pattern has not been found. Use `create-if-not-exists: true` to create a new comment anyway.',
);
return;
}
Expand Down

0 comments on commit a38b001

Please sign in to comment.