This directory contains a simple workflow that uses @actions/github-script
Without log file
npm test
With log file
ACT_LOG=true npm test
The above produces a log file called mock-api.log
- Create a local git repository using
mock-github
and initialize it whatever files we need along with.github
directory - Notice that
@actions/github-script
allows us to control the base url of the GitHub API by using the env variableGITHUB_API_URL
- We will use
setEnv("GITHUB_API_URL", "http://api.github.com")
to downgrade the GitHub API base url to HTTP since HTTPS requests cannot be mocked. - Use
act-js
to run the workflow inside the local git repository and compare expected output. Make sure to mock the api usingMoctokit
by setting the base url forMoctokit
to "http://api.github.com".