Worflow with dispatch and branches setting suddenly not supported anymore

Our workflow also started throwing a “Unexpected value ‘branches’” error today

on:
  workflow_dispatch:
    branches:
      - master

i solved this issue with this:

inputs:
      branch:
        default: "branch_name"

 - name: Setup branch to use
        uses: actions/checkout@v2
        with:
          repository: ${{ github.repository }}
          ref: '${{ github.event.inputs.branch }}' 

First feedback in my support ticket:

Thank you for contacting GitHub Support and sorry for the trouble.

I have raised this up with the engineering team to investigate.

I’ll provide an update as soon as I hear back from the team.

1 Like

The ability to specify branches was documented in a json-schema, which is loaded by GoLand so probably also by other Jetbrains IDEs.

https://json.schemastore.org/github-workflow.json

Edit: The json-schema does not mention branches for workflow_dispatch, only for pull_request. So based on that, it seems like the feature was undocumented.

If you change the workflow code from:

on:
  workflow_dispatch:
    branches:
      - master

to:

on:
  workflow_dispatch:

the workflow works again…

When you do this, with the ‘Run workflow’ button, you can select all branches to run the workflow against. In my understanding this additional branches parameter was a filter on the available branches you are able to select but I don’t see find it in the documentation.

Correct, I’ve resolved it by adding # at the start of the two lines for the branches. But I vaguely remember, that this solution with workflow_dispatch + branches was mentioned / documented somewhere.

Same error here! I’ve just reported the bug using the following link: Bug report - GitHub Support.
I also checked actions documentation and nothing seems changed: Workflow syntax for GitHub Actions - GitHub Docs

Removing branches from workflow_dispatch worked for me too.

+1

This undocumented change has broken our environment

For now you can remove branches from the action so your action will work again on the workflow_dispatch

I also experienced this. Can confirm that it just stopped working less than 24 hours ago.

I’m seeing similar errors. Starting about 2 hours ago, some workflows started failing with the following error:

Invalid workflow file: .github/workflows/spinup-stack.yml#L4
The workflow is not valid. .github/workflows/spinup-stack.yml (Line: 4, Col: 5): Unexpected value 'name' .github/workflows/spinup-stack.yml (Line: 5, Col: 5): Unexpected value 'description'

These workflows were working earlier today and there haven’t been any changes to the workflow files.

Workflow YML:

name: Integration Tests
on:
  workflow_dispatch:
    name: 'Integration Tests'
    descriptions: '[...]'
    inputs:

I’m having the exact same problem too. Was working fine just 2 days ago for me.

Much like @DanielRuf, until today, this configuration worked without error on three repositories:

on:
  push:
    branches: [production]
  workflow_dispatch:
    branches: [production]

I’m seeing the syntax error message on two of those repositories and imagine the third will begin erroring out at some point, too.

Edit: In the time between submitting my message above and it getting approved, all three repositories fail using the noted configuration.

We are looking at the issue and working on a fix. The fields branches, name, description, and secrets have never been supported under workflow_dispatch but until recently they were silently ignored. The only valid key under workflow_dispatch is inputs.

7 Likes

@chrispat ah ok, thanks for the clarification. I was not aware of the fact, that they were just silently ignored. The UI told me otherwise, or my head is currently mixing things up.

The UI will let you pick a branch to run the workflow on if the workflow exists in that branch. But the branches tag does not have any impact on that. Also, the top level name key will give you a name for the workflow but adding a name key under workflow_dispatch does not do anything.

1 Like

Same for our action but we don’t use branches under workflow_dispatch:

 workflow_dispatch:
    inputs:
      client_ref:
        description: 'Branch, tag, or commit'
        required: false
      api_ref:
        description: 'Branch, tag, or commit'
        required: false

Similar issue here, it broke 2 github actions that were working fine yesterday. Both on self-hosted runners and the github hosted ones. No changes to the code.

We’re not using workflow_dispatch though, but it’s a complex file with lots of steps.
Similar error as the above users

Error: .github/workflows/test.yml (Line: 74, Col: 19):
Error: The template is not valid. .github/workflows/test.yml

edit: appears to be working again

1 Like

This post was flagged by the community and is temporarily hidden.