Skip to content

Commit

Permalink
Merge pull request #9114 from internetarchive/slack-recent-comment-bo…
Browse files Browse the repository at this point in the history
…t-improvements

update slack recent comments bot to add tracking labels
  • Loading branch information
jimchamp committed Apr 19, 2024
2 parents ce273d8 + df95abf commit 1f614a1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/gh_scripts/issue_comment_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@ def time_since(hours):
return since, since.strftime('%Y-%m-%dT%H:%M:%S')


def add_label_to_issues(issues):
for issue in issues:
issue_labels_url = f"https://api.github.com/repos/internetarchive/openlibrary/issues/{issue['number']}/labels"
response = requests.post(
issue_labels_url,
json={"labels": ["Needs: Response"]},
headers=github_headers,
)


def start_job(args: argparse.Namespace):
"""
Starts the new comment digest job.
Expand All @@ -253,6 +263,7 @@ def start_job(args: argparse.Namespace):
issues = fetch_issues(date_string)

filtered_issues = filter_issues(issues, since)
add_label_to_issues(filtered_issues)
publish_digest(filtered_issues, args.channel, args.slack_token, args.hours)
print('Digest posted to Slack.')

Expand Down

0 comments on commit 1f614a1

Please sign in to comment.