Skip to content

Instantly share code, notes, and snippets.

@ovitente
Created January 21, 2020 13:14
Show Gist options
  • Save ovitente/36e6d85304e8627b6f86160352257b0e to your computer and use it in GitHub Desktop.
Save ovitente/36e6d85304e8627b6f86160352257b0e to your computer and use it in GitHub Desktop.
A way to debug Github Actions workflows
---
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners
name : debug
on :
push :
branches : [ "master" ]
tags : [ "v[0-9]+.[0-9]+.[0-9]+" ]
pull_request :
types :
- "opened"
- "reopened"
- "synchronize"
jobs :
default :
# needs : [ "default" ]
timeout-minutes : 60
runs-on : ${{ matrix.machine }}
# container : { image : "${{ matrix.container }}" }
strategy :
matrix :
container : [ "alpine:latest" ]
machine : [ "ubuntu-latest" ]
services :
default :
image : "nginx:alpine"
ports : [ "8080:80" ]
steps :
- name : checkout
uses : "actions/checkout@v1"
# - name : docker compose up
# run : "docker-compose up -d"
- name : machine echo env
env : { CONTENT : "${{ toJson(env) }}" }
run : "echo $CONTENT"
- name : machine echo secrets
env : { CONTENT : "${{ toJson(secrets) }}" }
run : "echo $CONTENT"
- name : machine echo github
env : { CONTENT : "${{ toJson(github) }}" }
run : "echo $CONTENT"
- name : machine echo runner
env : { CONTENT : "${{ toJson(runner) }}" }
run : "echo $CONTENT"
- name : machine echo job
env : { CONTENT : "${{ toJson(job) }}" }
run : "echo $CONTENT"
- name : machine echo strategy
env : { CONTENT : "${{ toJson(strategy) }}" }
run : "echo $CONTENT"
- name : machine echo matrix
env : { CONTENT : "${{ toJson(matrix) }}" }
run : "echo $CONTENT"
- name : machine echo steps
env : { CONTENT : "${{ toJson(steps) }}" }
run : "echo $CONTENT"
- name : machine echo $GITHUB_ACTOR
run : "echo $GITHUB_ACTOR"
- name : machine echo $GITHUB_EVENT_NAME
run : "echo $GITHUB_EVENT_NAME"
- name : machine echo $GITHUB_ACTIONS
run : "echo $GITHUB_ACTIONS"
- name : machine echo $GITHUB_WORKFLOW
run : "echo $GITHUB_WORKFLOW"
- name : machine echo $GITHUB_ACTION
run : "echo $GITHUB_ACTION"
- name : machine echo $GITHUB_REPOSITORY
run : "echo $GITHUB_REPOSITORY"
- name : machine echo $GITHUB_BASE_REF
run : "echo $GITHUB_BASE_REF"
- name : machine echo $GITHUB_HEAD_REF
run : "echo $GITHUB_HEAD_REF"
- name : machine echo $GITHUB_REF
run : "echo $GITHUB_REF"
- name : machine echo $GITHUB_SHA
run : "echo $GITHUB_SHA"
- name : machine echo $GITHUB_EVENT_PATH
run : "echo $GITHUB_EVENT_PATH"
- name : machine echo $GITHUB_WORKSPACE
run : "echo $GITHUB_WORKSPACE"
- name : machine echo $HOME
run : "echo $HOME"
- name : container ls $GITHUB_EVENT_PATH
with : { entrypoint : "/bin/sh" , args : '-c "ls -la $GITHUB_EVENT_PATH"' }
uses : "docker://alpine:latest"
- name : container ls $GITHUB_WORKSPACE
with : { entrypoint : "/bin/sh" , args : '-c "ls -la $GITHUB_WORKSPACE"' }
uses : "docker://alpine:latest"
- name : container ls $HOME
with : { entrypoint : "/bin/sh" , args : '-c "ls -la $HOME"' }
uses : "docker://alpine:latest"
- name : machine ls $GITHUB_EVENT_PATH
run : "ls -la $GITHUB_EVENT_PATH"
- name : machine ls $GITHUB_WORKSPACE
run : "ls -la $GITHUB_WORKSPACE"
- name : machine ls $HOME
working-directory : "."
run : "ls -la $HOME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment