Skip to content

Commit

Permalink
Merge pull request #31 from khushail/khushail/checkBotLogin
Browse files Browse the repository at this point in the history
fix: replaced bodyText with bot login
  • Loading branch information
peterwoodworth authored Jul 7, 2023
2 parents 4028cd6 + b3f6592 commit 73b58dc
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 27 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# "Handle Stale Discussions" Action for Github Action

This Github action checks the **answerable discussions** in your repository for an answer with the keyword `@github-actions proposed-answer`. If a positive reaction (thumbsup, laughing, rocket, heart, hooray) is received on the proposed answer, the discussion is marked as answered and closed as resolved. Otherwise if a negative reaction (thumbsdown, confused) is added or a reply is received, a label (`attention` by default) is added so the discussion can gain attention from the repository maintainers. If there is no reaction or response to a proposed answer after 7 days by default, the discussion is closed as outdated.
This Github action checks the **answerable discussions** in your repository for an answer with the keyword `@github-actions proposed-answer`.

* If a positive reaction (thumbsup, laughing, rocket, heart, hooray) is received on the proposed answer, the discussion is marked as answered and closed as resolved.

* Otherwise if a negative reaction (thumbsdown, confused) is added or a reply is received, a label (`attention` by default) is added so the discussion can gain attention from the repository maintainers.

If there is no reaction or response to a proposed answer after 7 days by default, the discussion is closed as outdated.

If this workflow is configured to run when a discussion comment is created, then it will check if the newly created comment is a proposed answer. If it is, then an instructions response will be posted right away. This way, people can immediately know how to interact with the discussions bot. Please note, this is the only action that will occur on a new comment event trigger. Any other event which invokes this action will process all answerable discussions and comments in the repository.

Expand Down Expand Up @@ -41,7 +47,7 @@ jobs:
- uses: aws-github-ops/handle-stale-discussions@v1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
attention-label: needs-attention
attention-label: attention
```
## Inputs
Expand Down Expand Up @@ -86,7 +92,9 @@ Comment to post as a reply when a proposed answer is given

Default:

> Hello! A team member has marked the above comment as the likely answer to this discussion thread. If you agree, please upvote that comment, or click on `Mark as answer`. I will automatically mark the comment as the answer next time I check. If this answer doesn't help you, please downvote the answer instead and let us know why it wasn't helpful. I will add a label to this discussion to gain attention from the team.
> Hello! A team member has marked the above comment as the likely answer to this discussion thread.
* If you agree, please upvote that comment, or click on `Mark as answer`. I will automatically mark the comment as the answer next time I check.
* If this answer doesn't help you, please downvote the answer instead and let us know why it wasn't helpful. I will add a label to this discussion to gain attention from the team.

### stale-response-text

Expand All @@ -102,6 +110,18 @@ Close stale discussions as answered

Default: `false`. Stale discussions are closed as outdated.

### github-bot

Github action bot login name

Default: 'github-actions'. This login name will be used to check if the reply is posted by Github-actions bot.

### page-size

Page size count for the discussions nodes being loaded per page

Default: 50

## Contributing
We welcome community contributions and pull requests. See [CONTRIBUTING.md](https://github.com/aws-github-ops/handle-stale-discussions/blob/main/CONTRIBUTING.md) for information on how to submit code.

Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ inputs:
description: 'Close stale discussions as answered'
required: false
default: false
github-bot:
description: 'Github action bot login name'
required: false
default: 'github-actions'
page-size:
description: 'Page size count for discussions to be loaded per page'
required: false
default: 50
5 changes: 4 additions & 1 deletion dist/generated/graphql.js

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions dist/index.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions dist/types/generated/graphql.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38930,6 +38930,22 @@ export type GetCommentMetaDataQuery = {
__typename?: 'DiscussionCommentConnection';
totalCount: number;
};
author?: {
__typename?: 'Bot';
login: string;
} | {
__typename?: 'EnterpriseUserAccount';
login: string;
} | {
__typename?: 'Mannequin';
login: string;
} | {
__typename?: 'Organization';
login: string;
} | {
__typename?: 'User';
login: string;
} | null;
} | null;
} | null> | null;
};
Expand Down
2 changes: 1 addition & 1 deletion dist/types/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export declare function hasReaction(comment: DiscussionCommentEdge): boolean;
export declare function containsKeyword(comment: DiscussionCommentEdge, text: string): boolean;
export declare function exceedsDaysUntilStale(comment: DiscussionCommentEdge, staleTimeDays: number): boolean;
export declare function hasReplies(comment: DiscussionCommentEdge): boolean;
export declare function hasNonInstructionsReply(comments: DiscussionCommentEdge, INSTRUCTIONS_TEXT: string): boolean;
export declare function hasNonBotReply(comments: DiscussionCommentEdge, GITHUB_BOT: string): boolean;
export declare function triggeredByNewComment(): boolean;
Loading

0 comments on commit 73b58dc

Please sign in to comment.