woter324
woter324

Reputation: 3100

Set up GitHub workflow from existing YAML

I have a YAML pipeline that I want to run, but I can't work out how to tell GitHub to use my file and stop it from creating a new one.

The yaml file is in .github/workflows in my develop branch.

In GitHub, under Actions, if I click "set up a workflow yourself" it takes me to:

enter image description here

The path is correct but it's defaulting to the default master branch and clicking on master just takes me to the code view. I can't find a way to change it to develop

I believe the relevant part of the code is:

name: CI

# Controls when the action will run.
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

If I understand this correctly, workflow_dispatch should allow it to be run manually, but it doesn't appear to be listed.

I'm sure this is 101, but I can't work it out. If anyone has any ideas, I'd be grateful if you could share them, please.

Update 1

After @flaxon showed me how to change the URL to point to the correct branch, I am still unable to run a workflow. Even if I let GitHub create a new workflow, there's no option to run it. When I go to actions, this is all I see: enter image description here

Upvotes: 8

Views: 5497

Answers (2)

woter324
woter324

Reputation: 3100

Solution

Merge to master branch.

For reasons I don't understand, one has to merge develop into master. Maybe it's something to do with the default branch and if I had committed against master it wouldn't have been a problem. Anyhow, going to Action gives me the Workflows section and the workflow_dispatch attribute allows me to run it manually.

(I did wonder if it was to do with the push branch set to master, but changing it to develop made no difference).

enter image description here

Upvotes: 2

flaxon
flaxon

Reputation: 942

you can change it in the URL,

***/test-workflow/new/develop?filename=.github%2Fworkflows%2Fmain.yml&workflow_template=blank

Upvotes: 1

Related Questions