-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger Slack bot when errors are found in Prismic linting Github action run #11200
Conversation
Size Change: 0 B Total Size: 982 kB ℹ️ View Unchanged
|
prismic-model/lintPrismicData.ts
Outdated
|
||
// Send an alert to Editors if anything is found on a GitHub Action run | ||
// https://github.com/wellcomecollection/wellcomecollection.org/actions/workflows/prismic-linting.yml | ||
if (isGitHubAction && slackWebhookUrl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with the other prismic linting PR, could we rely solely on the slackWebhookUrl
to signal we should send to slack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The webhook url is always the same, and we don't want this to run when we run the report locally for our own testing, so I don't think it applies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hadn't noticed that we're pulling from secrets manager here for SLACK_WEBHOOK_GA_PRISMIC_LINTING_URL
, I wonder if either that could be externalised to another GHA step or move the secret retrieval inside the check for isGitHubAction
as it is unnecessary otherwise?
Is it useful to pass the webhook URL through an env var here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK discussed this with @agnesgaroux. We believe that because we already use a GitHub secret in the prismic-linting.yml
workflow/action, it makes sense to just move the secret to GitHub so both referenced secrets live in the same space. I'll just confirm it doesn't print it when it passes it to the script, but otherwise it's much simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed non printed
Run docker compose run prismic_model yarn lintPrismicData slackWebhookUrl=***
I've scheduled the AWS secret for deletion in 7 days.
prismic-model/lintPrismicData.ts
Outdated
@@ -29,6 +33,13 @@ type ErrorProps = { | |||
errors: string[]; | |||
}; | |||
|
|||
const { isGitHubAction } = yargs(process.argv.slice(2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See later comment about removing the need to worry about whether running in GHA or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 Chatops 💯
Comments are suggestion, not blocking for merge.
What does this change?
Relates to #11202
Currently, Natalie writes to #wc-editorial when the Prismic linting script reports errors on the dashboard.
This aims to give her one less task every morning!
I've added a webhook workflow that posts this little message when an error or more is found:
I'll be curious to test it against the action itself, but running it locally it seems to work smoothly. See the #bot-test channel in Slack that I've created for stuff like this for all the versions of the bot 😄 The currently still points to it, I'll change that once we're happy and everything is merged, and will tell Editors about it.
How to test
I ran it locally with
yarn lintPrismicData --isGitHubAction
and a mock test that I was sure would fail.How can we measure success?
Automated job, happy Natalie!
Have we considered potential risks?
Don't really see any that we couldn't address.