forked from tachiyomiorg/issue-moderator-action
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add delete command and delete test issues (upstream) (#10)
* Delete test issues after integ tests * Inline issueId for delete mutation * Add command to delete an issue * Fix typo --------- Co-authored-by: arkon <arkon@users.noreply.github.com>
- Loading branch information
1 parent
a017be8
commit 454c6a6
Showing
10 changed files
with
70 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as core from '@actions/core'; | ||
import * as github from '@actions/github'; | ||
|
||
import { GitHubClient } from '../../types'; | ||
import { deleteIssue as deleteIssueUtil } from '../../util/issues'; | ||
|
||
import { BOT_REGEX } from '.'; | ||
|
||
export async function deleteIssue(client: GitHubClient, commentBody: string) { | ||
// If the comment was a question, don't execute the command. | ||
if (!commentBody.match(BOT_REGEX) && commentBody.match(/#\d{3,4}\?/)) { | ||
core.info('Issue not closed because the comment contains a question'); | ||
return; | ||
} | ||
|
||
const { issue } = github.context; | ||
|
||
const issueMetadata = { | ||
owner: issue.owner, | ||
repo: issue.repo, | ||
issue_number: issue.number, | ||
}; | ||
const issueData = await client.rest.issues.get(issueMetadata); | ||
|
||
await deleteIssueUtil(client, issueData.data.node_id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters