Skip to content

Ability to add a step to a job #71

Closed
@TWiStErRob

Description

Feature request
I would like to insert a step into a workflow from a test.

I think this syntax would work:

      mockSteps: {
        "job-name": [
          {
            before: N, // or after: N,
            mockWith: {...}
          }
        ]
      }

Additional context
When testing local actions, we need to clone the MockGithub repository, but in production we don't need this and we don't want to create noise in the real executions by doing an if: ... or having a placeholder step to replace with mock.

Workaround
For now I did this:

      # "Placeholder for test to hook into."
      - id: checkout
        run: |
          true

+

      mockSteps: {
        "job-name": [
          {
            id: "checkout",
            mockWith: {
              name: "Checkout (test only)"
              uses: "actions/checkout@v4",
              run: undefined,
            }
          }
        ]
      }

Proposed solution

No yaml changes.
+

      mockSteps: {
        "job-name": [
          {
            before: 0,
            mockWith: {
              name: "Checkout (test only)"
              uses: "actions/checkout@v4",
            }
          }
        ]
      }

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions