Skip to content

GitHub Actions

Check out this quick guide. I recommend testing with a public repository as you go along with the guide. It’s very fast! ⚡️

  • It’s a good idea to install this VSCode extension. At the very least, it can help lint the YAML files you write.
  • You can test actions locally by using act, which essentially just uses the Docker API to do everything that GitHub would (but on your machine).
  • When authoring a workflow, consider using workflow_dispatch, which lets you manually trigger the workflow rather than waiting for an event like a push (reference, YAML reference):
on:
push:
branches: [main]
# Allow manual triggering. Just leave this blank if you have no inputs.
workflow_dispatch:
  • Note that you don’t need the YML file to specify contents: write; it’s your user that needs write permissions. So if you don’t have the “Run workflow” button after adding workflow_dispatch, make sure you’re logged in as an admin of the repo.

Finding a usable tag from an action in the marketplace

Section titled Finding a usable tag from an action in the marketplace

Suppose you’re on a page like this: https://github.com/docker/login-action. You may see a “View on Marketplace” button: Pasted image 20240108154124.png

Clicking that will bring you to a page with a version selector at the upper right which you can use to see which tags are available: Pasted image 20240108154212.png

Alternatively, you can just go to the Releases page and click “Tags” on it, which results in a URL like this: https://github.com/docker/login-action/tags

Can’t build a Docker image through GitHub actions

Section titled Can’t build a Docker image through GitHub actions

If you can build locally, then perhaps you should try cloning the repo and trying to build in that fresh clone. It’s possible that a COPY . . command doesn’t have the same source to copy from.