Skip to content

Commit 2af3cf0

Browse files
support issue_comment for prs
1 parent be10897 commit 2af3cf0

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

Diff for: dist/index.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/generate-project-query.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* GraphQl query to get project and column information
33
*
44
* @param {string} url - Issue or Pull request url
5-
* @param {string} eventName - The current event name
5+
* @param {string} is_pr - Whether the event is a Pull Request (false if it's an Issue)
66
* @param {string} project - The project to find
77
*/
8-
const projectQuery = (url, eventName, project) =>
8+
const projectQuery = (url, is_pr, project) =>
99
`query {
1010
resource( url: "${url}" ) {
11-
... on ${eventName.startsWith('issue') ? 'Issue' : 'PullRequest'} {
11+
... on ${!is_pr ? 'Issue' : 'PullRequest'} {
1212
projectCards {
1313
nodes {
1414
id

Diff for: src/get-action-data.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ const getActionData = githubContext => {
2525
eventName,
2626
action: payload.action,
2727
nodeId: githubData.node_id,
28-
url: githubData.html_url
29-
};
28+
url: githubData.html_url,
29+
is_pr: !!payload.pull_request || !!payload.issue.pull_request
30+
}
3031
};
3132

3233
module.exports = getActionData;

Diff for: src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ const generateMutationQuery = require('./generate-mutation-query');
1313
const action = core.getInput('action') || 'update';
1414

1515
// Get data from the current action
16-
const {eventName, nodeId, url} = getActionData(github.context);
16+
const {eventName, nodeId, url, is_pr} = getActionData(github.context);
1717

1818
// Create a method to query GitHub
1919
const octokit = new github.GitHub(token);
2020

2121
// Get the column ID from searching for the project and card Id if it exists
22-
const projectQuery = generateProjectQuery(url, eventName, project);
22+
const projectQuery = generateProjectQuery(url, is_pr, project);
2323

2424
core.debug(projectQuery);
2525

0 commit comments

Comments
 (0)