Reputation: 85
I created a GitHub action, I am looking for a way to test itself before publishing it to marketplace. How can I test it by creating a workflow file within the same repository?
I have the following workflow.
name: "Build"
on:
pull_request:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: test-action # name of my action
Upvotes: 6
Views: 4423
Reputation: 2195
There are different levels of testing: system, integration, unit.
I am also an author of many Actions and I've described my approach in the article. The main idea is:
The library emulates GitHub runner and has API to pass different inputs, env variables, analyse outputs, exit code, etc. of your action, supports executing JavaScript and Docker actions.
Upvotes: 1
Reputation: 23190
You can also call the action specific branch to use an action which hasn't been published yet (even in other repositories).
steps:
- uses: <username>/<repo-name>@<branch-name>
with:
# input params if there is any
This can (for example) allow to test implementations located in different branches.
Upvotes: 10
Reputation: 1325
You can use the ./
syntax to use an action available in the same repository.
steps:
- uses: ./
with:
# input params if you have any
Upvotes: 12