Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
fix: correctly handle "closed" event
Browse files Browse the repository at this point in the history
  • Loading branch information
z0al committed Dec 26, 2021
1 parent 8c8092a commit 0fae071
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ on:
types:
- opened
- edited
- closed
- reopened
pull_request_target:
types:
- opened
- edited
- closed
- reopened
# Makes sure we always add status check for PRs. Useful only if
# this action is required to pass before merging. Can be removed
# otherwise.
# this action is required to pass before merging AND we reference
# PRs/issues outside the current repository. Otherwise, it can be
# removed.
- synchronize

# Schedule a daily check. Useful if you reference cross-repository
# issues or pull requests. Can be removed otherwise.
# issues or pull requests. Otherwise, it can be removed.
schedule:
- cron: '0 0 * * *'

Expand Down
8 changes: 5 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export async function getActionContext(): Promise<ActionContext> {

let issues: Issue[] = [];

// Only run checks for the context.issue (if any)
// If we are running in an issue context then only run checks
// for the issue in question. Unless, it's a close event because
// then the issue could be a dependency of another PR/issue.
if (issue?.number) {
core.info(`Payload issue: #${issue?.number}`);
const remoteIssue = (
Expand All @@ -60,8 +62,8 @@ export async function getActionContext(): Promise<ActionContext> {
}

// Otherwise, check all open issues
else {
core.info(`Payload issue: None`);
if (issues.length === 0) {
core.info(`Payload issue: None or closed`);
const options = {
...repo,
state: 'open' as 'open',
Expand Down

0 comments on commit 0fae071

Please sign in to comment.