My Journey Into GitHub Actions - #2 - The Workflows Folder

2 minute read

If I go back to my repo, I can see that the default workflow I created was stored in a .github/workflows folder:

If I drill down into that folder, I can see the GitHub Actions workflow file I created previously, mickeys-first-workflow.yml:

And if I select the mickeys-first-workflow.yml file, I can view its contents:

What Happens If I Try And Edit This File

Let’s see what happens when I try and edit this file. I can do this by clicking the “pencil” icon at the top right.

It looks like it recognizes that this is a GitHub Actions workflow file, and opens me in what I am calling the “Workflow Editor” (I’m sure it has an official name, but I’ll call it this for now). Now this leads me to wonder, what gives it that knowledge? Is it the file extension? Or is it the file location.

Experiment 1 - Create Another YAML File In Workflows Folder

For this experiement, I’m going to create a new file in the workflows folder, and call it testing.yml. I do this by navigating to the workflows folder in my repo, then clicking the new file button.

I’m going to name the file testing.yml, add a comment into the file, then commit the file directly back to master. to save it. As you can see, I now have two files in the workflows folder.

And, if I click the testing.yml file, it does open into the “Workflow Editor”.

That was expected, since I already had a YAML file in this folder, and it opened in the workflow editor.

Experiment 2 - Create a Text File in the Workflows folder

Question: If I create a non-YAML file in the workflows folder, will it open in a regular editor, or in the workflows editor?

To test this out, I navigated to the workflows folder, and created a new text file, DoesThisWork.txt:

If I click this file to view it, and then click the “pencil” icon to edit the file, it opens in the regular text editor:

This leads me to hypothesize that the Workflow Editor may be tied to the extension on the file. Let’s test this.

Experiment 3 - Create a YAML file in the Root of the Repo

I created a deleteme.yml file in the root of my repo:

If I click to view the file, and then click the “pencil” icon to edit the file, it opens in a text editor:

This proves out that the file extension matters, but only when the file is in the workflows folder.

At this point, we have proven that the file has to have a .yml extension and must exist in the workflows folder in order to open in the Workflow Editor. I have one last experiment to try.

Experiment 4 - What If My YAML File is in a Subfolder of Workflows

I went back to the workflows folder, and in that folder I created a subfolder called mysubfolder. In that subfolder I then created a test.yml file.

If I select this file and edit it, it also opens in just the regular text editor.

My Findings

It looks like, to edit a GitHub Actions workflow YAML file using the Workflow Editor, that file needs to have a .yml extension, and needs to exist in the .github/workflows folder.

Something interesting I’ll have to try would be: do YAML files in subfolders trigger runs? Or do all the files have to be in the main workflows folder? I’ll have to test that out.