Skip to content

Commit 73b58dc

Browse files
Merge pull request #31 from khushail/khushail/checkBotLogin
fix: replaced bodyText with bot login
2 parents 4028cd6 + b3f6592 commit 73b58dc

File tree

11 files changed

+85
-27
lines changed

11 files changed

+85
-27
lines changed

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# "Handle Stale Discussions" Action for Github Action
22

3-
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.
3+
This Github action checks the **answerable discussions** in your repository for an answer with the keyword `@github-actions proposed-answer`.
4+
5+
* 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.
6+
7+
* 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.
8+
9+
If there is no reaction or response to a proposed answer after 7 days by default, the discussion is closed as outdated.
410

511
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.
612

@@ -41,7 +47,7 @@ jobs:
4147
- uses: aws-github-ops/handle-stale-discussions@v1
4248
with:
4349
github-token: ${{secrets.GITHUB_TOKEN}}
44-
attention-label: needs-attention
50+
attention-label: attention
4551
```
4652
4753
## Inputs
@@ -86,7 +92,9 @@ Comment to post as a reply when a proposed answer is given
8692

8793
Default:
8894

89-
> 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.
95+
> Hello! A team member has marked the above comment as the likely answer to this discussion thread.
96+
* 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.
97+
* 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.
9098

9199
### stale-response-text
92100

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

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

113+
### github-bot
114+
115+
Github action bot login name
116+
117+
Default: 'github-actions'. This login name will be used to check if the reply is posted by Github-actions bot.
118+
119+
### page-size
120+
121+
Page size count for the discussions nodes being loaded per page
122+
123+
Default: 50
124+
105125
## Contributing
106126
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.
107127

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,11 @@ inputs:
4040
description: 'Close stale discussions as answered'
4141
required: false
4242
default: false
43+
github-bot:
44+
description: 'Github action bot login name'
45+
required: false
46+
default: 'github-actions'
47+
page-size:
48+
description: 'Page size count for discussions to be loaded per page'
49+
required: false
50+
default: 50

dist/generated/graphql.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 14 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types/generated/graphql.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38930,6 +38930,22 @@ export type GetCommentMetaDataQuery = {
3893038930
__typename?: 'DiscussionCommentConnection';
3893138931
totalCount: number;
3893238932
};
38933+
author?: {
38934+
__typename?: 'Bot';
38935+
login: string;
38936+
} | {
38937+
__typename?: 'EnterpriseUserAccount';
38938+
login: string;
38939+
} | {
38940+
__typename?: 'Mannequin';
38941+
login: string;
38942+
} | {
38943+
__typename?: 'Organization';
38944+
login: string;
38945+
} | {
38946+
__typename?: 'User';
38947+
login: string;
38948+
} | null;
3893338949
} | null;
3893438950
} | null> | null;
3893538951
};

dist/types/util.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export declare function hasReaction(comment: DiscussionCommentEdge): boolean;
88
export declare function containsKeyword(comment: DiscussionCommentEdge, text: string): boolean;
99
export declare function exceedsDaysUntilStale(comment: DiscussionCommentEdge, staleTimeDays: number): boolean;
1010
export declare function hasReplies(comment: DiscussionCommentEdge): boolean;
11-
export declare function hasNonInstructionsReply(comments: DiscussionCommentEdge, INSTRUCTIONS_TEXT: string): boolean;
11+
export declare function hasNonBotReply(comments: DiscussionCommentEdge, GITHUB_BOT: string): boolean;
1212
export declare function triggeredByNewComment(): boolean;

0 commit comments

Comments
 (0)