This repo contains a collection of useful, reusable, GitHub Actions that can be used in your next project.
In the full-examples directory you will find some complete examples that could be simply copy and pasted into your application. Just give us a star.
GitHub Actions are a way of writing our automated pipelines to test, build, deploy our code. Among many other things. More can be found here along with the official documentation.
The official description is:
GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.
GitHub Actions are yaml files located in your applications .github/workflows directory.
They can be triggered by many things such as pushes to a branch, when a pull request is created, or when manually triggered. A full list of triggers can be found here
The structure of a GitHub Action workflow is as follows:
name: Example # Name of the actionon: [trigger-here] # What triggers the workflowjobs: # The tasks the workflow contains. What is actually runa-name: # The name of a jobruns-on: # The operating system to run onsteps: # Each step of the workflow
- uses: actions/example@v1 # A workflow provided by someone else on the market place.
...Create a directory in the root of your repo .github/workflows and copy any of the example actions from this repo.
Import an action into your main workflow with the following:
...
jobs:
example:
name: Exampleuses: ./.github/workflows/example.yml # full path is requiredanother-example:
name: Another exampleuses: ./.github/workflows/another-example.yml
...Adding paths-ignore: - <some-path> will prevent unnecessary runs of your actions. These paths could be "**.md" to exclude the README.md or RELEASENOTES.md, etc. Or "Documentation/**" to ignore irrelevant files about the application. These can be anything.
...
on:
push:
paths-ignore:
- "Documentation/**"
- "**.md"
...Preventing concurrent actions can be a good way to reduce unnecessary runs between quick pushes to a branch, for example.
...
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}cancel-in-progress: true
...If you have an Action that is missing, please feel free to create an pull request adding that action, along with an updated README on how to use that action.