📍 The GitHub Actions Guidepost

If you’re just getting started with GitHub Actions, you’ve come to the right place.

This guide is a collection of solutions and resources organized by topic. We’ve sourced them based on our team’s analysis of surveys and views.

Featured Co-authors: @airtower-luna, @ernest-phillips, @Simran-B

Workflow file and virtual machine configuration

Events

  • How do I trigger a workflow on the default branch after a pull request is merged to update it?
    • There are numerous ways to trigger a workflow only when a pull request is merged, as illustrated in this thread. Expanding on the accepted solution, consider creating a branch protection rule for your repository’s default development branch (main) and a workflow file that triggers whenever that branch is updated via the push event. That way, when any pull request is merged updating main, the workflow file is scoped to only run for that case.
  • Why didn’t some event trigger my workflow?
    • When you use the repository’s GITHUB_TOKEN to perform tasks on behalf of the GitHub Actions app, events triggered by the GITHUB_TOKEN will not create a new workflow run. This prevents you from accidentally creating recursive workflow runs, as highlighted in this topic. If you would like to trigger a workflow from a workflow run, you can trigger the event using a personal access token.
  • How do I run a workflow on a schedule?
  • Is there a way to run a workflow or a job if the head branch is from the same repository (or, if it’s only from some fork)?

Jobs, steps, and contexts

Scripting

Using the API

Acknowledged feature limitations and/or requests

Docker Caching

If you’re using Docker in your workflow file, you may come across a moment where you expect the image to be cached but instead see it being rebuilt on every run. As of today, there’s no caching – @airtower-luna’s explanation in this post shares more details. In addition, this actions/cache issue on Docker caching is the best place for adding to the conversation, as the team maintaining is aware of the interest in this feature.

Parallel Workflows

GitHub Packages Interoperability

Features


If you found something helped you, help our community by acknowledging it as a solution.

What’s something that you found most helpful from this list? Is there a collection of existing topics with solutions that you’d like to see posted here? Leave a comment below!

10 Likes

(Special thanks to @airtower-luna & @ernest-phillips for reviewing this guidepost. :sparkles:)

5 Likes

Thank u so much appreciate u

2 Likes

Hello and thanks @francisfuzz . Having gotten this far, I still don’t understand which specific branch protection rule needs to be set in order for my workflow to run only when the PR is merged updating main. I would really appreciate if someone could clarify this for me. Many thanks in advance

1 Like