Sunday, 19th April 2020
TIL
Only run GitHub Action on push to master / main
— Spotted in [this Cloud Run example](https://github.com/GoogleCloudPlatform/github-actions/blob/20c294aabd5331f9f7b8a26e6075d41c31ce5e0d/example-workflows/cloud-run/.github/workflows/cloud-run.yml):
TIL
Dump out all GitHub Actions context
— Useful for seeing what's available for `if: ` conditions (see [context and expression syntax](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions)).
TIL
Set environment variables for all steps in a GitHub Action
— From [this example](https://github.com/GoogleCloudPlatform/github-actions/blob/20c294aabd5331f9f7b8a26e6075d41c31ce5e0d/example-workflows/cloud-run/.github/workflows/cloud-run.yml) I learned that you can set environment variables such that they will be available in ALL jobs once at the top of a workflow:
TIL
Convert a datetime object to UTC without using pytz
— I wanted to convert a datetime object (from GitPython) to UTC without adding the `pytz` dependency.
TIL
Commit a file if it changed
— This recipe runs a Python script to update a README, then commits it back to the parent repo but only if it has changed:
TIL
Running a Python ASGI app on Vercel
— Vercel really wants you to deploy static assets with [serverless functions](https://vercel.com/docs/serverless-functions/introduction) tucked away in a separate folder. They suggest creating modules like `api/index.py` which will be served up automatically as API backends to your client-side JavaScript.