Skip to content

Instantly share code, notes, and snippets.

@KerberosMorphy
Created August 26, 2020 17:42
Show Gist options
  • Save KerberosMorphy/ffc1bd3f301c0a843708cdaf0f6ab3d5 to your computer and use it in GitHub Desktop.
Save KerberosMorphy/ffc1bd3f301c0a843708cdaf0f6ab3d5 to your computer and use it in GitHub Desktop.
Convert GitHub Action

Convert GitHub Action

IMPORTANT: Only Docker base action can be convert and GitHub Action outputs are not convertible.

  • Found action on GitHub Marketplace;

  • Go to the repository and search for action.yml;

  • runs key must be using 'docker':

    runs:
      using: "docker"
      image: "Dockerfile"
  • Looks for inputs key, GitHub convert each input in uppercase and add INPUT_ at the beginning:

    inputs:
      my_input:
        description: "My Input variable"
    - my_input
    + INPUT_MY_INPUT
  • If the action use env instead of with, you don't have to convert the input name:

     - name: My Action
       uses: toumoro/my-action@v1
    -  with:
    -    my_input: 'Some Value'
    +  env:
    +    MY_INPUT: 'Some Value'
  • Go to the DockerHub repository of the action to choose your tag.

  • To use docker instead of action in GitHub replace the uses with the docker image and don't use with key:

     - name: My Action
    -  uses: yourdockeraccount/my-action@v1
    +  uses: docker://yourdockeraccount/my-action:latest
    env:
      MY_INPUT: 'Some Value'

To GitLab CI

If GitHub Action use env

my_job:
  stage: my_stage
  image: yourdockeraccount/my-action:latest
  script: ["true"]
  variables:
    MY_INPUT: "Some Value"

If GitHub Action use with

my_job:
  stage: my_stage
  image: yourdockeraccount/my-action:latest
  script: ["true"]
  variables:
    INPUT_MY_INPUT: "Some Value"

To Bitbucket CI

If GitHub Action use env

pipelines:
  default:
    - step:
        name: My Action
        script:
          - pipe: docker://yourdockeraccount/my-action:latest
            variables:
              MY_INPUT: "Some Value"

If GitHub Action use with

pipelines:
  default:
    - step:
        name: My Action
        script:
          - pipe: docker://yourdockeraccount/my-action:latest
            variables:
              INPUT_MY_INPUT: "Some Value"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment