Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the issue_number of the issue being commented on as input #97

Open
Kosuke-KIDO-datalabs opened this issue Sep 15, 2024 · 3 comments · May be fixed by #101
Open

Add the issue_number of the issue being commented on as input #97

Kosuke-KIDO-datalabs opened this issue Sep 15, 2024 · 3 comments · May be fixed by #101
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Kosuke-KIDO-datalabs
Copy link

It would be helpful to be able to specify the issue to comment on, as I would like to use this action in a workflow triggered by issue_comment.

@MishaKav
Copy link
Owner

Can you please provide an example of what you mean.
Not sure that I understood you.

@Kosuke-KIDO-datalabs
Copy link
Author

Kosuke-KIDO-datalabs commented Sep 16, 2024

@MishaKav Thanks for confirming.

If triggered by issue_comment, the context pull_request should be empty.
So no coverage report will be posted anywhere at that time.

So I would like to be able to set the issue_number of the post destination myself as an optional argument.

const { eventName, payload } = context
const { repo, owner } = context.repo
const octokit = getOctokit(options.token)
const issue_number = payload.pull_request ? payload.pull_request.number : 0

My use case would be as follows.
Instead of running every time a change is committed to PR, we want to run CI only when /test is commented. The above problem occurs because the issue_comment trigger is used in that case.
https://github.com/orgs/community/discussions/25389

@MishaKav MishaKav added the good first issue Good for newcomers label Sep 17, 2024
@MishaKav
Copy link
Owner

I got you, I will implement this soon when I have some free time.

@MishaKav MishaKav added the enhancement New feature or request label Oct 10, 2024
MishaKav added a commit that referenced this issue Oct 27, 2024
Fixes #97

Add the ability to specify the issue number of the issue being commented on as an optional argument.

* Add `issue-number` input parameter in `action.yml` to specify the issue number.
* Update `createComment` function in `src/create-comment.ts` to accept `issueNumber` from `options` if provided, otherwise fallback to the current logic.
* Add logic in `src/index.ts` to retrieve the `issue-number` input parameter and pass it to the `createComment` function.
* Update `README.md` to include documentation for the new `issue-number` input parameter.
* Add `issueNumber` to `Options` interface in `src/types.d.ts`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/MishaKav/jest-coverage-comment/issues/97?shareId=XXXX-XXXX-XXXX-XXXX).
@MishaKav MishaKav linked a pull request Oct 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants