GitHub Actions
Useful Links
- GitHub Actions Runners
- GitHub Actions Events
- GitHub Actions Events Filters
- GitHub Actions Workflow Skip
- GitHub Actions Contexts
- GitHub Actions Expressions
- GitHub Actions Workflow Syntax
- GitHub Actions Default Environment Variables
- GitHub Actions Reuse Workflows
Storing Actions in Repositories & Sharing Actions with Others
In this section, we explain how to create and share custom Actions stored in separate repositories, instead of keeping them inside the same repository as your workflows.
How to create and share a custom Action in its own repository:
-
Create a new local project folder
This folder should contain your action.yml file and all the code needed for your Action.
Important: Do not put your action.yml or code inside a .github/actions folder or similar. Keep everything at the root level of your new project folder. -
Initialize a Git repository
Run the following command inside your project folder:
git init
- Add and commit your files
git add .
git commit -m "Initial commit for my custom Action"
-
Create a GitHub repository
Create a new repository on GitHub to host your Action. -
Connect your local repo to GitHub remote
git remote add origin https://github.com/my-account/my-action.git
- Tag a release version
It's a good practice to tag your Action versions for reuse:
git tag -a -m "My action release" v1
- Push your code and tags to GitHub
git push --follow-tags origin main
- Use your custom Action in workflows
Reference your custom Action in any other workflow by specifying the repository and tag, like this:
uses: my-account/my-action@v1