You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the GitHub Actions workflow runs once every five minutes, which is the maximum frequency that GHA can run a scheduled workflow at. Each time the workflow runs it checks the Hypothesis API once for new annotations, posts any new ones to Slack, and then exits.
This means that after creating an annotation in Hypothesis it can take up to five minutes for the annotation to appear in Slack.
We'd like this to be faster.
Possible solution
GitHub Actions jobs are allowed to run for up to 6 hours continuously. Change the slack-annotations script to call the Hypothesis API, post any new annotations to Slack, sleep for n seconds (say n=5) then repeat in a loop for 3 hours then exit. And change the scheduled GitHub Actions workflows that run the script (eng_annotations.yml and pr_website.yml) to run the script every 3 hours instead of every 5 minutes.
It won't be perfect, but this hack should mean that, for the most part, annotations get posted into Slack within a few seconds after they're created. This should be more than good enough.
Notes:
There's a test.yml workflow that calls the slack-annotations script and posts results into the #test-slack-annotations Slack channel. This test workflow isn't run automatically, it's only run manually for testing purposes. When running this test workflow we would not want the script to loop for three hours, we'd want it to loop only once then exit. So the time to loop for will need to be a command line argument to the script.
Currently the Python script itself doesn't actually post annotations to Slack, it just prints them out in a Slack-compatible format and then after the script exits the GHA workflow pipes its output to Slack's official GitHub action to do the actual posting for us. This was just a shortcut to save me time not having to write my own code for posting to Slack. In order to implement the looping hack I think you'll have to change it to have the Python code itself actually do the posting to the Slack API instead of piping to Slack's action, as that'll be necessary in order to post in a loop.
The script will need to take a Slack API token as a command line argument.
It might be convenient to have a --dry-run option for testing locally without a Slack API token: just print out some messages about what would have been posted to Slack.
eng_annotations.yml and pr_website.yml have Dead Man's Snitch alerts that expect the scheduled workflows to complete once an hour otherwise an alarm will go off. These should be changed to three hours.
The text was updated successfully, but these errors were encountered:
Problem
Currently the GitHub Actions workflow runs once every five minutes, which is the maximum frequency that GHA can run a scheduled workflow at. Each time the workflow runs it checks the Hypothesis API once for new annotations, posts any new ones to Slack, and then exits.
This means that after creating an annotation in Hypothesis it can take up to five minutes for the annotation to appear in Slack.
We'd like this to be faster.
Possible solution
GitHub Actions jobs are allowed to run for up to 6 hours continuously. Change the
slack-annotations
script to call the Hypothesis API, post any new annotations to Slack, sleep forn
seconds (sayn=5
) then repeat in a loop for 3 hours then exit. And change the scheduled GitHub Actions workflows that run the script (eng_annotations.yml
andpr_website.yml
) to run the script every 3 hours instead of every 5 minutes.It won't be perfect, but this hack should mean that, for the most part, annotations get posted into Slack within a few seconds after they're created. This should be more than good enough.
Notes:
There's a
test.yml
workflow that calls theslack-annotations
script and posts results into the#test-slack-annotations
Slack channel. This test workflow isn't run automatically, it's only run manually for testing purposes. When running this test workflow we would not want the script to loop for three hours, we'd want it to loop only once then exit. So the time to loop for will need to be a command line argument to the script.Currently the Python script itself doesn't actually post annotations to Slack, it just prints them out in a Slack-compatible format and then after the script exits the GHA workflow pipes its output to Slack's official GitHub action to do the actual posting for us. This was just a shortcut to save me time not having to write my own code for posting to Slack. In order to implement the looping hack I think you'll have to change it to have the Python code itself actually do the posting to the Slack API instead of piping to Slack's action, as that'll be necessary in order to post in a loop.
notify.yml
workflow can pass${{ secrets.SLACK_BOT_TOKEN }}
as the command line argument.--dry-run
option for testing locally without a Slack API token: just print out some messages about what would have been posted to Slack.eng_annotations.yml
andpr_website.yml
have Dead Man's Snitch alerts that expect the scheduled workflows to complete once an hour otherwise an alarm will go off. These should be changed to three hours.The text was updated successfully, but these errors were encountered: