No GITHUB_REF in scheduled workflow

Hello, I have a simple workflow (simplified below) that runs tests and deploys if the changes are on master. The “Test and deploy” workflow works well, but the “Daily build” workflow fails:

$GITHUB_REF is not set
### FAILED Master branch 05:01:31Z (10.995s)

Scheduled workflows are only triggered on master anyway, but I need the “Master branch” check for the “Test and deploy” workflow.

Based on the doc on this page https://developer.github.com/actions/managing-workflows/workflow-configuration-options/#events-supported-in-workflow-files GITHUB_REF should be defined.

Can I fix this workflow without duplicating the “Deploy” action to skip the “Master branch” check?

workflow "Test and deploy" {
  on = "push"
  resolves = ["Deploy"]
}

workflow "Daily build" {
  on = "schedule(0 5 * * *)"
  resolves = ["Deploy"]
}

action "Run tests" {
  uses = "./python/"
  args = ["pip install -r requirements.txt && nosetests -s -v"]
}

action "Master branch" {
  needs = "Run tests"
  uses = "actions/bin/filter@master"
  args = "branch master"
}

action "Deploy" {
  needs = "Master branch"
  uses = "actions/aws/cli@master"
  ... do things
}

Hi @paulineribeyre,

Thanks for being here! And apologies for the delay in response, If I’m understanding this correctly, you do have to duplicate the action to skip that check. 

1 Like

Hello, thank you for your answer! Yes, I duplicated the workflow to skip the check and avoid the error. But why is there an error in the first place? “actions/bin/filter@master” should work in a scheduled workflow