Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Tips and Traps
-
You can use
sudowithout password in Linux and macOS when running GitHub Actions. -
GitHub Actions supports manual triggers with workflow_dispatch. Workflow parameters are supported in manually triggers.
-
GITHUB_TOKENis an automatically generated secret that lets you make authenticated calls to the GitHub API in your workflow runs. Actions generates a new token for each job and expires the token when a job completes.GITHUB_TOKENcan also be used for the GitHub Actionpeter-evans/create-pull-requestto create PRs automatically. However, GitHub bot is the owner of a PR created by the GitHub action create-pull-request withGITHUB_TOKENwhich might have issues triggering other pipelines listening to PR events. A simple solution to this problem is to manually create a repository secret (e.g.,GITHUBACTIONS) and use it to autenticate the GitHub Action create-pull-request withGITHUB_TOKEN. -
Rust cannot be installed into a global location following instructions at Install Rust Globally in Linux . This might because GitHub Actions VMs have restrictions on environemnt variables. You can still install Rust using root (via sudo) but this doesn't give you much priviledge as the root account in a GitHub Actions VM is restricted too.
-
OS: ubuntu-latest, windows-latest, macOS-latest
-
Good practices for GitHub repository with GitHub Actions workflows:
- Have 2 protected branches
mainanddev, wheremainis reserved for releasing anddevis reserved for development. - Fork the
devbranch for development. - A PR from
devtomainshould be made when it is ready to release a new version.
- Have 2 protected branches
Branch Matching
on:
push:
branches:
- '*' # matches every branch that doesn't contain a '/'
- '*/*' # matches every branch containing a single '/'
- '**' # matches every branch
- '!master' # excludes master
For more discussions, please refer to GitHub Actions: how to target all branches EXCEPT master? and Workflow syntax for GitHub Actions .
Good Github Actions
checkout
ssh-agent
ssh-agent
is a GitHub Action to setup ssh-agent with a private key.
bencher
Bencher is a suite of continuous benchmarking tools.
GitHub Actions for Python
https://hynek.me/articles/python-github-actions/
https://github.com/actions/setup-python
Pull Request
https://github.com/peter-evans/create-pull-request
Create PR from push on a given branch
Examples
Using semantic-release with GitHub Actions
Automatic Deployment With Github Actions
Zip Code Base with Github Actions for Releases
Introducing GitHub Package Registry