[GH-ISSUE #1795] act requries all yaml files in subdirectories to be workflows, but shouldn't #874

Closed
opened 2026-03-01 21:47:05 +03:00 by kerem · 6 comments
Owner

Originally created by @sebix on GitHub (May 10, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1795

Bug report info

act version:            0.2.45
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
Config files:           
	/home/sebastianw/.actrc:
		-P ubuntu-latest=catthehacker/ubuntu:act-latest
		-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
		-P ubuntu-20.04=catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
	Go version:            go1.18.10
	Module path:           github.com/nektos/act
	Main version:          (devel)
	Main path:             github.com/nektos/act
	Main checksum:         
	Build settings:
		-compiler:            gc
		-ldflags:             -s -w -X main.version=0.2.45 -X main.commit=f1df2ca5d6b315935cf9bb0d2a989175adf4e894 -X main.date=2023-05-01T02:18:49Z -X main.builtBy=goreleaser
		CGO_ENABLED:          0
		GOARCH:               amd64
		GOOS:                 linux
		GOAMD64:              v1
		vcs:                  git
		vcs.revision:         f1df2ca5d6b315935cf9bb0d2a989175adf4e894
		vcs.time:             2023-05-01T02:18:34Z
		vcs.modified:         false
Docker Engine:
	Engine version:        23.0.5-ce
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         systemd
	Storage driver:        btrfs
	Registry URI:          https://index.docker.io/v1/
	OS:                    openSUSE Tumbleweed
	OS type:               linux
	OS version:            20230508
	OS arch:               x86_64
	OS kernel:             6.3.1-1-default
	OS CPU:                8
	OS memory:             31880 MB
	Security options:
		name=apparmor
		name=seccomp,profile=builtin
		name=cgroupns

Command used with act

act -l

Describe issue

This is the actual output:

Error: workflow is not valid. 'ansible-playbook.yml': yaml: unmarshal errors:
  line 5: cannot unmarshal !!seq into model.Workflow

But I expect that workflows are listed like

Stage  Job ID              Job name                                                Workflow name                        Workflow file        Events                    
0      ansible             Run ansible tests                                       Run ansible tests                    ansible-tests.yml    push,pull_request         
...

The issue is the file .github/workflows/scripts/ansible-playbook.yml which is not a workflow file, but act tries to parse it as a workflow file although it isn't placed in the workflow directory.

These workflows work on GitHub, see: https://github.com/certtools/intelmq/actions/

github.com/certtools/intelmq/

Workflow content

#Github Workflow to run ansible tests
#
#SPDX-FileCopyrightText: 2021 Birger Schacht <schacht@cert.at>
#SPDX-License-Identifier: AGPL-3.0-or-later
#
name: "Run ansible tests"
on:
  push:
    branches: [develop, maintenance, master]
    paths-ignore:
      - '.github/**'
  pull_request:
    branches: [develop, maintenance]
    paths-ignore:
      - '.github/**'

jobs:
  ansible:
    # temporary fix for https://github.com/actions/virtual-environments/issues/3080
    runs-on: ubuntu-22.04
    name: Run ansible tests

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with:
        path: ./src/intelmq

    - name: Checkout ansible scripts
      uses: actions/checkout@v2
      with:
        repository: certtools/intelmq-vagrant
        path: ./src/intelmq-vagrant
    - run: apt update && apt install -y podman
    - name: Run ansible tests
      run: podman run -e CI=${CI} -v ${GITHUB_WORKSPACE}/src:/src docker.io/debian:buster-slim /src/intelmq/.github/workflows/scripts/ansible.sh

Relevant log output

DEBU[0000] Loading environment from /home/user/dev/intelmq/.env 
DEBU[0000] Loading action inputs from /home/user/dev/intelmq/.input 
DEBU[0000] Loading secrets from /home/user/dev/intelmq/.secrets 
DEBU[0000] Evaluated matrix inclusions: map[]           
DEBU[0000] Loading workflows from '/home/user/dev/intelmq/.github/workflows' 
DEBU[0000] Loading workflows recursively                
DEBU[0000] Found workflow 'ansible-tests.yml' in '/home/user/dev/intelmq/.github/workflows/ansible-tests.yml' 
DEBU[0000] Found workflow 'build-docs.yml' in '/home/user/dev/intelmq/.github/workflows/build-docs.yml' 
DEBU[0000] Found workflow 'codeql-analysis.yml' in '/home/user/dev/intelmq/.github/workflows/codeql-analysis.yml' 
DEBU[0000] Found workflow 'codespell.excludelines' in '/home/user/dev/intelmq/.github/workflows/codespell.excludelines' 
DEBU[0000] Found workflow 'codespell.yml' in '/home/user/dev/intelmq/.github/workflows/codespell.yml' 
DEBU[0000] Found workflow 'debian-package.yml' in '/home/user/dev/intelmq/.github/workflows/debian-package.yml' 
DEBU[0000] Found workflow 'docker.yml' in '/home/user/dev/intelmq/.github/workflows/docker.yml' 
DEBU[0000] Found workflow 'pycodestyle.yml' in '/home/user/dev/intelmq/.github/workflows/pycodestyle.yml' 
DEBU[0000] Found workflow 'github.py' in '/home/user/dev/intelmq/.github/workflows/python/github.py' 
DEBU[0000] Found workflow 'pycodestyle_comment.py' in '/home/user/dev/intelmq/.github/workflows/python/pycodestyle_comment.py' 
DEBU[0000] Found workflow 'regexploit.yml' in '/home/user/dev/intelmq/.github/workflows/regexploit.yml' 
DEBU[0000] Found workflow 'reuse.yml' in '/home/user/dev/intelmq/.github/workflows/reuse.yml' 
DEBU[0000] Found workflow 'ansible-playbook.yml' in '/home/user/dev/intelmq/.github/workflows/scripts/ansible-playbook.yml' 
DEBU[0000] Unable to load etag from /home/user/.cache/act/.notices.etag: &{%!e(string=open) %!e(string=/home/user/.cache/act/.notices.etag) %!e(syscall.Errno=2)} 
DEBU[0000] Found workflow 'ansible.sh' in '/home/user/dev/intelmq/.github/workflows/scripts/ansible.sh' 
DEBU[0000] Found workflow 'debian-package.sh' in '/home/user/dev/intelmq/.github/workflows/scripts/debian-package.sh' 
DEBU[0000] Found workflow 'regexploit.sh' in '/home/user/dev/intelmq/.github/workflows/scripts/regexploit.sh' 
DEBU[0000] Found workflow 'setup-full.sh' in '/home/user/dev/intelmq/.github/workflows/scripts/setup-full.sh' 
DEBU[0000] Found workflow 'unittests.yml' in '/home/user/dev/intelmq/.github/workflows/unittests.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/ansible-tests.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/build-docs.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/codeql-analysis.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/codespell.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/debian-package.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/docker.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/pycodestyle.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/regexploit.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/reuse.yml' 
DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/scripts/ansible-playbook.yml' 
Error: workflow is not valid. 'ansible-playbook.yml': yaml: unmarshal errors:
  line 5: cannot unmarshal !!seq into model.Workflow

Additional information

No response

Originally created by @sebix on GitHub (May 10, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1795 ### Bug report info ```plain text act version: 0.2.45 GOOS: linux GOARCH: amd64 NumCPU: 8 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /home/sebastianw/.actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 Build info: Go version: go1.18.10 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -compiler: gc -ldflags: -s -w -X main.version=0.2.45 -X main.commit=f1df2ca5d6b315935cf9bb0d2a989175adf4e894 -X main.date=2023-05-01T02:18:49Z -X main.builtBy=goreleaser CGO_ENABLED: 0 GOARCH: amd64 GOOS: linux GOAMD64: v1 vcs: git vcs.revision: f1df2ca5d6b315935cf9bb0d2a989175adf4e894 vcs.time: 2023-05-01T02:18:34Z vcs.modified: false Docker Engine: Engine version: 23.0.5-ce Engine runtime: runc Cgroup version: 2 Cgroup driver: systemd Storage driver: btrfs Registry URI: https://index.docker.io/v1/ OS: openSUSE Tumbleweed OS type: linux OS version: 20230508 OS arch: x86_64 OS kernel: 6.3.1-1-default OS CPU: 8 OS memory: 31880 MB Security options: name=apparmor name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act -l ``` ### Describe issue This is the actual output: ``` Error: workflow is not valid. 'ansible-playbook.yml': yaml: unmarshal errors: line 5: cannot unmarshal !!seq into model.Workflow ``` But I expect that workflows are listed like ``` Stage Job ID Job name Workflow name Workflow file Events 0 ansible Run ansible tests Run ansible tests ansible-tests.yml push,pull_request ... ``` The issue is the file `.github/workflows/scripts/ansible-playbook.yml` which is not a workflow file, but act tries to parse it as a workflow file although it isn't placed in the workflow directory. These workflows work on GitHub, see: https://github.com/certtools/intelmq/actions/ ### Link to GitHub repository github.com/certtools/intelmq/ ### Workflow content ```yml #Github Workflow to run ansible tests # #SPDX-FileCopyrightText: 2021 Birger Schacht <schacht@cert.at> #SPDX-License-Identifier: AGPL-3.0-or-later # name: "Run ansible tests" on: push: branches: [develop, maintenance, master] paths-ignore: - '.github/**' pull_request: branches: [develop, maintenance] paths-ignore: - '.github/**' jobs: ansible: # temporary fix for https://github.com/actions/virtual-environments/issues/3080 runs-on: ubuntu-22.04 name: Run ansible tests steps: - name: Checkout repository uses: actions/checkout@v2 with: path: ./src/intelmq - name: Checkout ansible scripts uses: actions/checkout@v2 with: repository: certtools/intelmq-vagrant path: ./src/intelmq-vagrant - run: apt update && apt install -y podman - name: Run ansible tests run: podman run -e CI=${CI} -v ${GITHUB_WORKSPACE}/src:/src docker.io/debian:buster-slim /src/intelmq/.github/workflows/scripts/ansible.sh ``` ### Relevant log output ```sh DEBU[0000] Loading environment from /home/user/dev/intelmq/.env DEBU[0000] Loading action inputs from /home/user/dev/intelmq/.input DEBU[0000] Loading secrets from /home/user/dev/intelmq/.secrets DEBU[0000] Evaluated matrix inclusions: map[] DEBU[0000] Loading workflows from '/home/user/dev/intelmq/.github/workflows' DEBU[0000] Loading workflows recursively DEBU[0000] Found workflow 'ansible-tests.yml' in '/home/user/dev/intelmq/.github/workflows/ansible-tests.yml' DEBU[0000] Found workflow 'build-docs.yml' in '/home/user/dev/intelmq/.github/workflows/build-docs.yml' DEBU[0000] Found workflow 'codeql-analysis.yml' in '/home/user/dev/intelmq/.github/workflows/codeql-analysis.yml' DEBU[0000] Found workflow 'codespell.excludelines' in '/home/user/dev/intelmq/.github/workflows/codespell.excludelines' DEBU[0000] Found workflow 'codespell.yml' in '/home/user/dev/intelmq/.github/workflows/codespell.yml' DEBU[0000] Found workflow 'debian-package.yml' in '/home/user/dev/intelmq/.github/workflows/debian-package.yml' DEBU[0000] Found workflow 'docker.yml' in '/home/user/dev/intelmq/.github/workflows/docker.yml' DEBU[0000] Found workflow 'pycodestyle.yml' in '/home/user/dev/intelmq/.github/workflows/pycodestyle.yml' DEBU[0000] Found workflow 'github.py' in '/home/user/dev/intelmq/.github/workflows/python/github.py' DEBU[0000] Found workflow 'pycodestyle_comment.py' in '/home/user/dev/intelmq/.github/workflows/python/pycodestyle_comment.py' DEBU[0000] Found workflow 'regexploit.yml' in '/home/user/dev/intelmq/.github/workflows/regexploit.yml' DEBU[0000] Found workflow 'reuse.yml' in '/home/user/dev/intelmq/.github/workflows/reuse.yml' DEBU[0000] Found workflow 'ansible-playbook.yml' in '/home/user/dev/intelmq/.github/workflows/scripts/ansible-playbook.yml' DEBU[0000] Unable to load etag from /home/user/.cache/act/.notices.etag: &{%!e(string=open) %!e(string=/home/user/.cache/act/.notices.etag) %!e(syscall.Errno=2)} DEBU[0000] Found workflow 'ansible.sh' in '/home/user/dev/intelmq/.github/workflows/scripts/ansible.sh' DEBU[0000] Found workflow 'debian-package.sh' in '/home/user/dev/intelmq/.github/workflows/scripts/debian-package.sh' DEBU[0000] Found workflow 'regexploit.sh' in '/home/user/dev/intelmq/.github/workflows/scripts/regexploit.sh' DEBU[0000] Found workflow 'setup-full.sh' in '/home/user/dev/intelmq/.github/workflows/scripts/setup-full.sh' DEBU[0000] Found workflow 'unittests.yml' in '/home/user/dev/intelmq/.github/workflows/unittests.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/ansible-tests.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/build-docs.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/codeql-analysis.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/codespell.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/debian-package.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/docker.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/pycodestyle.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/regexploit.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/reuse.yml' DEBU[0000] Reading workflow '/home/user/dev/intelmq/.github/workflows/scripts/ansible-playbook.yml' Error: workflow is not valid. 'ansible-playbook.yml': yaml: unmarshal errors: line 5: cannot unmarshal !!seq into model.Workflow ``` ### Additional information _No response_
kerem 2026-03-01 21:47:05 +03:00
Author
Owner

@ChristopherHX commented on GitHub (May 10, 2023):

I wondered why recursively loading of workflows was ever merged into act (I didn't had the permission to block that), you can unblock your issue with the flag --no-recurse.

act -l --no-recurse

I don't think it is best practice to store non workflow files under .github/workflows/**/*, because this .github folder may introduce new config file locations at any point of time.

Do you want to open a PR to set the default value of the flag to true? github.com/nektos/act@65ef31f102/cmd/root.go (L73)

You would only need to replace false with true.

<!-- gh-comment-id:1541610610 --> @ChristopherHX commented on GitHub (May 10, 2023): I wondered why recursively loading of workflows was ever merged into act (I didn't had the permission to block that), you can unblock your issue with the flag `--no-recurse`. `act -l --no-recurse` I don't think it is best practice to store non workflow files under `.github/workflows/**/*`, because this `.github` folder may introduce new config file locations at any point of time. Do you want to open a PR to set the default value of the flag to true? https://github.com/nektos/act/blob/65ef31f102ceb75623973921099454637bab55b0/cmd/root.go#L73 You would only need to replace `false` with `true`.
Author
Owner

@sebix commented on GitHub (May 10, 2023):

As long as GitHub itself does not load workflows recursively, I don't think it's adequate to do it in act for consistency.

<!-- gh-comment-id:1542704679 --> @sebix commented on GitHub (May 10, 2023): As long as GitHub itself does not load workflows recursively, I don't think it's adequate to do it in `act` for consistency.
Author
Owner

@JoshMcCullough commented on GitHub (May 15, 2023):

For this issue, it seems like (as suggested above) non-workflow files shouldn't be stored under .github/workflows. Instead, the should live somewhere else in the repo and be referenced from the workflows.

<!-- gh-comment-id:1548474353 --> @JoshMcCullough commented on GitHub (May 15, 2023): For this issue, it seems like (as suggested above) non-workflow files shouldn't be stored under `.github/workflows`. Instead, the should live somewhere else in the repo and be referenced from the workflows.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 12, 2023):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1806951186 --> @github-actions[bot] commented on GitHub (Nov 12, 2023): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@dezren39 commented on GitHub (Nov 16, 2023):

For this issue, it seems like (as suggested above) non-workflow files shouldn't be stored under .github/workflows. Instead, the should live somewhere else in the repo and be referenced from the workflows.

this isn't documented in github, it's probably a best practice of sorts not to do this, but it's common to see variations in how people use the workflows folder. sort of like 'things in .github/workflows are build stuff, the rest is the "real code"'. i don't subscribe to that personally, but i've had multiple experiences (mostly in enterprise) where this has occurred. I suggest that, where possible, act should try to avoid putting additional constraints on users that github actions doesn't have.

<!-- gh-comment-id:1813564200 --> @dezren39 commented on GitHub (Nov 16, 2023): > For this issue, it seems like (as suggested above) non-workflow files shouldn't be stored under `.github/workflows`. Instead, the should live somewhere else in the repo and be referenced from the workflows. this isn't documented in github, it's probably a best practice of sorts not to do this, but it's common to see variations in how people use the workflows folder. sort of like 'things in .github/workflows are build stuff, the rest is the "real code"'. i don't subscribe to that personally, but i've had multiple experiences (mostly in enterprise) where this has occurred. I suggest that, where possible, act should try to avoid putting additional constraints on users that github actions doesn't have.
Author
Owner

@github-actions[bot] commented on GitHub (May 15, 2024):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:2111356803 --> @github-actions[bot] commented on GitHub (May 15, 2024): Issue is stale and will be closed in 14 days unless there is new activity
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#874
No description provided.