GitHub Actions pipeline integration

Using the GitHub action converter in Codefresh pipelines

GitHub Actions are a set of reusable workflows that can be composed to create automation sequences for GitHub projects. GitHub Actions are supported natively with GitHub, but you can also use them in Codefresh pipelines by automatically converting them to Codefresh pipeline steps.

GitHub Actions Marketplace

GitHub Actions Marketplace

By using GitHub Actions in your marketplace, you have the following benefits:


To use a GitHub Action in Codefresh you need to make sure that the following apply:

  1. The GitHub action you have selected is Docker-based and has a self-contained and valid Dockerfile
  2. You have read the documentation of the GitHub Action and know what arguments/input it requires

Since GitHub Actions are created by the community, it is your responsibility to filter and curate any GitHub Action you wish to use in Codefresh pipelines. If for example you use a GitHub Action that is then removed by its owner, the Codefresh pipeline that uses it will break as well.
We suggest you first use a GitHub Action in a GitHub workflow in order to understand its requirements, before you use it in a Codefresh pipeline.

How it works

Codefresh offers a github-action-to-codefresh step converter.
This converter has two functions:

  1. When you create your pipeline it will analyze the GitHub Action and find what arguments it requires.
    You must then define the values needed by yourself.
  2. When the pipeline runs, it automatically finds the Dockerfile of the GitHub Action, builds it, and makes available the Docker image in any subsequent step in the same pipeline.

All this process is automatic. You just need to make sure that all arguments/inputs of the GitHub Action are provided using pipeline variables, shared configuration, or any other standard mechanism you already use in Codefresh.

Inserting a GitHub Action in Codefresh pipeline

  1. Create a Codefresh pipeline by visiting the pipeline editor.
  2. In the Steps tab on the right-hand side, search for actions and select GitHub Actions.

Step browser

Step browser
  1. Scroll down to find the GitHub Action that you want to use or enter a keyword to filter the list.

Select GitHub action

Select GitHub action
  1. Click on the GitHub Action you want to use in your pipeline.
    Codefresh displays the YAML for the action on the right. This is the step that you need to insert in your pipeline.

Using the Snyk GitHub action

Using the Snyk GitHub action

The YAML snippet is a template, and you need to fill the env block below the arguments block.
The required environment variables are specific to each GitHub Action, so check the documentation of the action itself.

In the example above, we use the Snyk GitHub Action. By visiting the documentation page, we find that this action expects a SNYK_TOKEN as input.

We therefore add the token as a pipeline variable:

Pipeline variables

Pipeline variables

Here is the final pipeline:


version: '1.0'
    title: snyk
    description: snyk
    type: github-action-executor:0.2.2
      url: ''
        - SNYK_TOKEN: '${{SNYK_TOKEN}}'
      cmd: test alpine@latest

The cmd property is specific to each GitHub action and in the case of Snyk we say we want to scan an alpine image for security issues.

Running a Codefresh pipeline with GitHub Actions

You can run the pipeline as any other Codefresh pipeline.

Using GitHub Actions in a Codefresh pipeline

Using GitHub Actions in a Codefresh pipeline

Once the pipeline reaches the GitHub Action step, the converter automatically does the following:

  1. Finds the Dockerfile of the GitHub Action
  2. Builds the Dockerfile
  3. Takes the resulting image and inserts it as Codefresh step
  4. Passes the environment variables as arguments to the GitHub Action
  5. Runs the cmd command

If you have issues, please contact us or open a support ticket, and let us know which GitHub Action you are trying to use and the URL of the Codefresh build that fails.

Steps in pipelines
Plugin marketplace