[GH-ISSUE #1468] Ability to run workflow by specifying a workflow file #756

Closed
opened 2026-03-01 21:46:06 +03:00 by kerem · 3 comments
Owner

Originally created by @simonw on GitHub (Nov 26, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1468

Act version

0.2.33

Feature description

I tried act against my https://github.com/simonw/datasette project which has quite a few workflows. When I run act -l I get this:

Stage  Job ID               Job name             Workflow name                                   Workflow file            Events                             
0      deploy               deploy               Deploy latest.datasette.io                      deploy-latest.yml        push                               
0      documentation-links  documentation-links  Read the Docs Pull Request Preview              documentation-links.yml  pull_request_target                
0      prettier             prettier             Check JavaScript for conformance with Prettier  prettier.yml             push                               
0      test                 test                 Publish Python Package                          publish.yml              release                            
0      deploy_docker        deploy_docker        Push specific Docker tag                        push_docker_tag.yml      workflow_dispatch                  
0      spellcheck           spellcheck           Check spelling in documentation                 spellcheck.yml           push,pull_request                  
0      test                 test                 Calculate test coverage                         test-coverage.yml        push,pull_request                  
0      test                 test                 Test in Pyodide with shot-scraper               test-pyodide.yml         push,pull_request,workflow_dispatch
0      test                 test                 Test                                            test.yml                 push,pull_request                  
0      build                build                tmate session mac                               tmate-mac.yml            workflow_dispatch                  
0      build                build                tmate session                                   tmate.yml                workflow_dispatch                  
1      deploy               deploy               Publish Python Package                          publish.yml              release                            
2      deploy_docker        deploy_docker        Publish Python Package                          publish.yml              release                            
2      deploy_static_docs   deploy_static_docs   Publish Python Package                          publish.yml              release         

As you can see, I did a bad job here with my Job IDs - I have multiple duplicates.

I'd really like to be able to run a specific job by indicating the workflow file plus the job ID within that file. For example, to run my "Test in Pyodide with shot-scraper" workflow I'd like to be able to do something like this:

act -f test-pyodide.yml -j test
Originally created by @simonw on GitHub (Nov 26, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1468 ### Act version 0.2.33 ### Feature description I tried `act` against my https://github.com/simonw/datasette project which has quite a few workflows. When I run `act -l` I get this: ``` Stage Job ID Job name Workflow name Workflow file Events 0 deploy deploy Deploy latest.datasette.io deploy-latest.yml push 0 documentation-links documentation-links Read the Docs Pull Request Preview documentation-links.yml pull_request_target 0 prettier prettier Check JavaScript for conformance with Prettier prettier.yml push 0 test test Publish Python Package publish.yml release 0 deploy_docker deploy_docker Push specific Docker tag push_docker_tag.yml workflow_dispatch 0 spellcheck spellcheck Check spelling in documentation spellcheck.yml push,pull_request 0 test test Calculate test coverage test-coverage.yml push,pull_request 0 test test Test in Pyodide with shot-scraper test-pyodide.yml push,pull_request,workflow_dispatch 0 test test Test test.yml push,pull_request 0 build build tmate session mac tmate-mac.yml workflow_dispatch 0 build build tmate session tmate.yml workflow_dispatch 1 deploy deploy Publish Python Package publish.yml release 2 deploy_docker deploy_docker Publish Python Package publish.yml release 2 deploy_static_docs deploy_static_docs Publish Python Package publish.yml release ``` As you can see, I did a bad job here with my Job IDs - I have multiple duplicates. I'd really like to be able to run a specific job by indicating the workflow file plus the job ID within that file. For example, to run my "Test in Pyodide with shot-scraper" workflow I'd like to be able to do something like this: act -f test-pyodide.yml -j test
kerem 2026-03-01 21:46:06 +03:00
Author
Owner

@KnisterPeter commented on GitHub (Nov 26, 2022):

Run act -h and read the output

<!-- gh-comment-id:1328129903 --> @KnisterPeter commented on GitHub (Nov 26, 2022): Run act -h and read the output
Author
Owner

@simonw commented on GitHub (Nov 27, 2022):

I had read act -h pretty closely - the only option that looked like it might be relevant was this one:

  -W, --workflows string     path to workflow file(s) (default "./.github/workflows/")

But that help string and the fact that it was called --workflows and mentioned "file(s)" gave me the incorrect impression that this was a way of saying "look for my YAML files in this other directory" - not "only consider the jobs in this specific YAML file".

I did however just notice the following at the bottom of the act -l output:

Detected multiple jobs with the same job name, use `-W` to specify the path to the specific workflow.

So it looks like the option I'm looking for does exist, but the documentation wasn't quite clear enough for me to spot it.

For anyone else who finds this issue, here's how to run a job from a specific file:

 act -j test -W .github/workflows/test-pyodide.yml
<!-- gh-comment-id:1328149724 --> @simonw commented on GitHub (Nov 27, 2022): I had read `act -h` pretty closely - the only option that looked like it might be relevant was this one: ``` -W, --workflows string path to workflow file(s) (default "./.github/workflows/") ``` But that help string and the fact that it was called `--workflows` and mentioned "file(s)" gave me the incorrect impression that this was a way of saying "look for my YAML files in this other directory" - not "only consider the jobs in this specific YAML file". I did however just notice the following at the bottom of the `act -l` output: ``` Detected multiple jobs with the same job name, use `-W` to specify the path to the specific workflow. ``` So it looks like the option I'm looking for does exist, but the documentation wasn't quite clear enough for me to spot it. For anyone else who finds this issue, here's how to run a job from a specific file: act -j test -W .github/workflows/test-pyodide.yml
Author
Owner

@KnisterPeter commented on GitHub (Nov 27, 2022):

Thanks for improving the docs 😊

<!-- gh-comment-id:1328194949 --> @KnisterPeter commented on GitHub (Nov 27, 2022): Thanks for improving the docs 😊
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#756
No description provided.