GitHub Actions Explaination#
The GitHub Actions workflows are a combination of settings in GitHub and .yml files in the .github folder of the repo. The .yml files reference secrets and variables stored in GitHub (as well as default GitHub environment variables).
This document explains where the secrets and variables are set in GitHub and explains the elements found in the GitHub Actions .yml files in the repo.
There are 2 Default Environment Variables#
{{ github.ref }}
{{ github.head_ref }}
These are default environment variables that GitHub makes available to every step in a workflow. Read about these here: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
3 Secrets in GitHub#
{{ secrets.SSH_PRIVATE_KEY }}
- Can't remember if this is an SSH key
- Found info on Pantheon SSH Keys here: https://docs.pantheon.io/ssh-keys
{{ secrets.PANTHEON_MACHINE_TOKEN }}
- Machine token generated in Panthoen.
- Secret contains machine token set on Pantheon in personal settings: https://dashboard.pantheon.io/personal-settings/machine-tokens
{{ secrets.GITHUB_TOKEN }}
- GitHub says this: “When using a personal access token in a GitHub Actions workflow, consider whether you can use the built-in GITHUB_TOKEN instead. For more information, see "Automatic token authentication."
- See info about how these work here: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
To set secrets (or view how they're set up in existing repos):
1. Go to the "settings" tab for the repo.
1. Click "secrets and variables > actions" in the left menu.
1. View the "secrets" tab.
3 Variables Set in GitHub#
{{ vars.GIT_REMOTE }}
- Variable contains the ssh repo link info from “clone with git” from Pantheon Dev: https://dashboard.pantheon.io/sites/e8608eb8-da8f-4782-9211-a8d818a8961d
{{ vars.PANTHEON_SITE }}
- Variable contains the site name from Pantheon (ll-drupal, npl-d8, etc.).
{{ vars.PANTHEON_MULTIDEV_CLONE_ENV }}
- Variable contains the name of the environment from which we want to create the multidev (dev, test, live). We use live.
To set variables (or view how they're set up in existing repo):
1. Go to the "settings" tab for the repo.
1. Click "secrets and variables > actions" in the left menu.
1. View the "variables" tab.
Other Variables#
{{ env.PANTHEON_MULTIDEV }}
- It looks like the build process stores the name of the feature branch in the PANTHEON_MULTIDEV variable. And we use this variable later in the workflow to build the multidev URL.