Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 3

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-suppo... 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
}

 

 

2 Replies
Highlighted
Community Manager
Message 2 of 3

Re: No GITHUB_REF in scheduled workflow

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. 


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Copilot Lvl 2
Message 3 of 3

Re: No GITHUB_REF in scheduled workflow

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