Skip to content

Commit d847826

Browse files
committed
allow direct invocation
1 parent 6add086 commit d847826

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.github/actions/help-command/action.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
github-token:
66
description: 'GitHub token for posting comments'
77
required: true
8+
issue-number:
9+
description: 'PR/Issue number to post the comment to (optional, defaults to event context)'
10+
required: false
811

912
runs:
1013
using: "composite"
@@ -81,11 +84,14 @@ runs:
8184
].join('\n');
8285
8386
const context = github.context;
84-
if (context.eventName === 'issue_comment') {
87+
const issueNumber = inputs['issue-number'] ||
88+
(context.eventName === 'issue_comment' ? context.payload.issue.number : null);
89+
90+
if (issueNumber) {
8591
await github.rest.issues.createComment({
8692
owner: context.repo.owner,
8793
repo: context.repo.repo,
88-
issue_number: context.payload.issue.number,
94+
issue_number: issueNumber,
8995
body: helpText
9096
});
9197
} else {

.github/workflows/help-command.yml

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
issue_comment:
88
types: [created]
99
workflow_dispatch:
10+
inputs:
11+
issue-number:
12+
description: 'PR/Issue number to post the help comment to'
13+
required: true
14+
type: number
1015

1116
permissions:
1217
issues: write
@@ -29,3 +34,4 @@ jobs:
2934
uses: ./.github/actions/help-command
3035
with:
3136
github-token: ${{ secrets.GITHUB_TOKEN }}
37+
issue-number: ${{ github.event.inputs.issue-number }}

0 commit comments

Comments
 (0)