Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 505
woter324 Avatar asked Jul 01 '26 12:07

woter324


2 Answers

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

like image 69
woter324 Avatar answered Jul 05 '26 06:07

woter324


you can change it in the URL,

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

like image 24
flaxon Avatar answered Jul 05 '26 07:07

flaxon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!