Skip to content
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

Merged
merged 8 commits into from
Sep 26, 2024

Conversation

rcantin-w
Copy link
Contributor

@rcantin-w rcantin-w commented Sep 24, 2024

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:

Screenshot 2024-09-24 at 11 43 47

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.

@rcantin-w rcantin-w marked this pull request as ready for review September 24, 2024 10:48
@rcantin-w rcantin-w requested a review from a team as a code owner September 24, 2024 10:48
Copy link

github-actions bot commented Sep 24, 2024

Size Change: 0 B

Total Size: 982 kB

ℹ️ View Unchanged
Filename Size
content/webapp/.next/static/chunks/00a8a139.976ae5fd9989bf10.js 59 kB
content/webapp/.next/static/chunks/1002-7318e6a4085ebb66.js 4.3 kB
content/webapp/.next/static/chunks/132.89ddc8dc5a16e946.js 4.56 kB
content/webapp/.next/static/chunks/1349.d6b39a7b1797cead.js 3.18 kB
content/webapp/.next/static/chunks/1624.b89ceeee5fe47ee4.js 270 B
content/webapp/.next/static/chunks/1747-04275179916658b9.js 6.96 kB
content/webapp/.next/static/chunks/2223.13e51946be4f0995.js 1.8 kB
content/webapp/.next/static/chunks/2224.6dc70c4ed9216f1e.js 408 B
content/webapp/.next/static/chunks/2545.87290edf97092fbe.js 3.49 kB
content/webapp/.next/static/chunks/2568.5b2f6dd966922d33.js 2.81 kB
content/webapp/.next/static/chunks/2630-b0aa14d36d3ed72e.js 4.46 kB
content/webapp/.next/static/chunks/267-dd02c91cf99b9029.js 3.68 kB
content/webapp/.next/static/chunks/286.b066630328a98bd8.js 20.8 kB
content/webapp/.next/static/chunks/3.9648c1811327a237.js 2.77 kB
content/webapp/.next/static/chunks/3199.dff24e66346c37ff.js 2.58 kB
content/webapp/.next/static/chunks/3250-7e336d01c7e28499.js 3.45 kB
content/webapp/.next/static/chunks/3419.35e7d06626e8c6d0.js 420 B
content/webapp/.next/static/chunks/3420-7e0cf6c9a569a227.js 3.87 kB
content/webapp/.next/static/chunks/3627.3684abdbe8510420.js 1.77 kB
content/webapp/.next/static/chunks/382-ca57e688a4545109.js 3.07 kB
content/webapp/.next/static/chunks/4468.8625f93c1d45e2e7.js 6.42 kB
content/webapp/.next/static/chunks/4621-7a41830ea122bce9.js 5.13 kB
content/webapp/.next/static/chunks/4825-4df3e43759acfe8c.js 7.76 kB
content/webapp/.next/static/chunks/4962-1a876f84ea228198.js 12.3 kB
content/webapp/.next/static/chunks/5006-5697252811b9fb3b.js 7.58 kB
content/webapp/.next/static/chunks/5048.438a6a11b28aaee3.js 4.87 kB
content/webapp/.next/static/chunks/5068.6a34c51d39e01be7.js 3.31 kB
content/webapp/.next/static/chunks/5292-ed27921f3c17eb90.js 2.83 kB
content/webapp/.next/static/chunks/5389.d762d43fb2d0a421.js 1.7 kB
content/webapp/.next/static/chunks/5637-9d223fd2073e2e27.js 20.3 kB
content/webapp/.next/static/chunks/5768-699dd21166035c67.js 3.18 kB
content/webapp/.next/static/chunks/6207.5630c6f7d5cfcad5.js 268 B
content/webapp/.next/static/chunks/6318.2f48effda9fb2484.js 2.29 kB
content/webapp/.next/static/chunks/6501.28ce8d42744c59bf.js 281 B
content/webapp/.next/static/chunks/6577-effbaab7dae5448b.js 3.52 kB
content/webapp/.next/static/chunks/6614-b5e60133ee409d9f.js 5.07 kB
content/webapp/.next/static/chunks/6862-86fce1f307733562.js 4.42 kB
content/webapp/.next/static/chunks/6879.1a3956a9bdfd883b.js 2.59 kB
content/webapp/.next/static/chunks/7044-f217d62ec10463bb.js 5.42 kB
content/webapp/.next/static/chunks/7107-a5393520646f32da.js 26.8 kB
content/webapp/.next/static/chunks/722-cd2b6f1157404546.js 3.22 kB
content/webapp/.next/static/chunks/7414-03438ef5466cad65.js 6 kB
content/webapp/.next/static/chunks/7440.0aaaaeca9284f9c5.js 4.79 kB
content/webapp/.next/static/chunks/7888.f28493fb337edae5.js 5.3 kB
content/webapp/.next/static/chunks/8189-461a5e1315036809.js 3.45 kB
content/webapp/.next/static/chunks/8348.aa1b6d3523200ada.js 3.28 kB
content/webapp/.next/static/chunks/8476-561d746cd9ef0a49.js 3.95 kB
content/webapp/.next/static/chunks/9042-448e49feb8581ddb.js 5.13 kB
content/webapp/.next/static/chunks/9049-a63f6fa100834eba.js 3.63 kB
content/webapp/.next/static/chunks/908.abd53c491bc03590.js 3.88 kB
content/webapp/.next/static/chunks/9519-30137c80b8ed44b4.js 7.63 kB
content/webapp/.next/static/chunks/9590.257ac6e54ecc6b12.js 2.64 kB
content/webapp/.next/static/chunks/9680-68fd13189afcdb6c.js 3.07 kB
content/webapp/.next/static/chunks/9778-bbbaf5f372498000.js 3.06 kB
content/webapp/.next/static/chunks/9950.5e05aa3683568cd8.js 3.17 kB
content/webapp/.next/static/chunks/framework-cd51c6317946e9aa.js 45.2 kB
content/webapp/.next/static/chunks/main-978dba4ddde48128.js 30.7 kB
content/webapp/.next/static/chunks/pages/_app-3b765a29130cb6ec.js 110 kB
content/webapp/.next/static/chunks/pages/_error-4ae94352bfd58ed4.js 335 B
content/webapp/.next/static/chunks/pages/404-9b6af81752f83cf9.js 263 B
content/webapp/.next/static/chunks/pages/500-7bf98e2f0d70a0db.js 262 B
content/webapp/.next/static/chunks/pages/articles-ccc87d95706566a5.js 2.33 kB
content/webapp/.next/static/chunks/pages/articles/[articleId]-77559f94b40c9fea.js 6.76 kB
content/webapp/.next/static/chunks/pages/books-f74f8877e8d2ae22.js 2.34 kB
content/webapp/.next/static/chunks/pages/books/[bookId]-205fc666810253ef.js 4.18 kB
content/webapp/.next/static/chunks/pages/collections-9c161636e96dcb2a.js 2.05 kB
content/webapp/.next/static/chunks/pages/concepts/[conceptId]-b825dc614e4f0d6d.js 3.86 kB
content/webapp/.next/static/chunks/pages/cookie-policy-b7c3495ebe0d428a.js 6.3 kB
content/webapp/.next/static/chunks/pages/event-series/[eventSeriesId]-af85bb35b49beee1.js 3.28 kB
content/webapp/.next/static/chunks/pages/events-2c04ad94e9473102.js 2.46 kB
content/webapp/.next/static/chunks/pages/events/[eventId]-34f7c28756ddeda9.js 9.1 kB
content/webapp/.next/static/chunks/pages/events/[eventId]/visual-stories-a983536c3e5e28a8.js 302 B
content/webapp/.next/static/chunks/pages/exhibitions-a193800d85741759.js 2.69 kB
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]-0436dfec51f74b84.js 4.35 kB
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]/visual-stories-d1aeb46e8e916d28.js 303 B
content/webapp/.next/static/chunks/pages/guides/[guideId]-c6ccf3989dad1d43.js 2.28 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions-910a812666e91549.js 2.95 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]-25ca5c328c5ca257.js 3.24 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]-2bc3de35add87b4f.js 7.64 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]/[stop]-5b9bca91ad938c4e.js 3.93 kB
content/webapp/.next/static/chunks/pages/index-445bc46eaeacac8d.js 3.69 kB
content/webapp/.next/static/chunks/pages/newsletter-aea425fc275336f8.js 2.39 kB
content/webapp/.next/static/chunks/pages/pages/[pageId]-9277c40f050b2c52.js 1.93 kB
content/webapp/.next/static/chunks/pages/projects/[projectId]-fd5c7e40f40b06d5.js 2.27 kB
content/webapp/.next/static/chunks/pages/search-6b210632bd238fb5.js 5.31 kB
content/webapp/.next/static/chunks/pages/search/events-867a1fa76abae653.js 2.05 kB
content/webapp/.next/static/chunks/pages/search/images-b4352e2e8a2f93cf.js 1.6 kB
content/webapp/.next/static/chunks/pages/search/stories-5cd0772d837241ef.js 3.24 kB
content/webapp/.next/static/chunks/pages/search/works-f295e6170487a32c.js 4.39 kB
content/webapp/.next/static/chunks/pages/seasons/[seasonId]-646788a0a41c9448.js 3.94 kB
content/webapp/.next/static/chunks/pages/series/[seriesId]-7eb03b202f3ddff7.js 5.54 kB
content/webapp/.next/static/chunks/pages/slice-simulator-16e50d643e0f3ca7.js 8.48 kB
content/webapp/.next/static/chunks/pages/stories-92df68cf08e3721c.js 1.77 kB
content/webapp/.next/static/chunks/pages/stories/[contentType]-8841c066725e8e28.js 2.38 kB
content/webapp/.next/static/chunks/pages/visit-us-376a2b2137b62675.js 2.44 kB
content/webapp/.next/static/chunks/pages/visual-stories/[visualStoryId]-0e090de4ea368053.js 237 B
content/webapp/.next/static/chunks/pages/whats-on-d3f1b7279bb5142e.js 213 B
content/webapp/.next/static/chunks/pages/whats-on/[period]-9d135cd2564e60da.js 285 B
content/webapp/.next/static/chunks/pages/works/[workId]-53965a76c9c08c92.js 21.9 kB
content/webapp/.next/static/chunks/pages/works/[workId]/download-4bc6a8116175ff34.js 3.05 kB
content/webapp/.next/static/chunks/pages/works/[workId]/images-3b4c5529899b032b.js 678 B
content/webapp/.next/static/chunks/pages/works/[workId]/items-012550f624ac99f2.js 216 B
content/webapp/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js 31.1 kB
content/webapp/.next/static/chunks/webpack-1c3db58824467ac2.js 2.33 kB
identity/webapp/.next/static/chunks/286.b94e91b70e38ea49.js 20.7 kB
identity/webapp/.next/static/chunks/374.94537fd117195c86.js 2.47 kB
identity/webapp/.next/static/chunks/432.fa29da5acdb8e0b1.js 744 B
identity/webapp/.next/static/chunks/442-f1af16c3993c320a.js 8.96 kB
identity/webapp/.next/static/chunks/644-9f6f94597a590125.js 15.1 kB
identity/webapp/.next/static/chunks/framework-b330de622121c9cc.js 45.2 kB
identity/webapp/.next/static/chunks/main-d973a3979032d64a.js 32.2 kB
identity/webapp/.next/static/chunks/pages/_app-529482e47a7a7e83.js 104 kB
identity/webapp/.next/static/chunks/pages/_error-8e82953fa241027d.js 1.42 kB
identity/webapp/.next/static/chunks/pages/delete-requested-32da5e51e2ea42f5.js 3.22 kB
identity/webapp/.next/static/chunks/pages/error-3aedecc75254a2a5.js 1.7 kB
identity/webapp/.next/static/chunks/pages/index-fd4c5090edefd1f4.js 11.9 kB
identity/webapp/.next/static/chunks/pages/registration-818958e1107234a1.js 4.12 kB
identity/webapp/.next/static/chunks/pages/success-5cf03c6d5d43603d.js 3.29 kB
identity/webapp/.next/static/chunks/pages/validated-cf6a1d145744ff16.js 3.36 kB
identity/webapp/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js 31.1 kB
identity/webapp/.next/static/chunks/webpack-d9d97d637ba6ec7a.js 1.82 kB

compressed-size-action

@rcantin-w rcantin-w changed the title Slack webhook when errors are found in Prismic linting Github action run Trigger Slack bot when errors are found in Prismic linting Github action run Sep 24, 2024

// 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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@@ -29,6 +33,13 @@ type ErrorProps = {
errors: string[];
};

const { isGitHubAction } = yargs(process.argv.slice(2))
Copy link
Contributor

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.

Copy link
Contributor

@kenoir kenoir left a 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.

@rcantin-w rcantin-w merged commit ef9fcbc into main Sep 26, 2024
8 checks passed
@rcantin-w rcantin-w deleted the prismic-linting-slack branch September 26, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants