Added info about the differences with GitHub, and allow passing through GITHUB_TOKEN

This commit is contained in:
Thomas Schoffelen 2018-12-31 19:55:46 +01:00
parent 49642105e8
commit 75af7eb53b
No known key found for this signature in database
GPG Key ID: 03F5C979F442A38D
2 changed files with 13 additions and 5 deletions

View File

@ -30,7 +30,7 @@ Options:
-h, --help output usage information
```
### Passing secrets
### Supplying values for secrets
You can set the value of [secrets](https://developer.github.com/actions/creating-workflows/storing-secrets/) defined in your workflow by passing them as environment variables, e.g.:
@ -38,6 +38,14 @@ You can set the value of [secrets](https://developer.github.com/actions/creating
MY_SECRET_TOKEN=yo-mamma gha
```
### Differences with GitHub Actions
Although this way of locally running GitHub Actions is very close to how they
will work when actually running them on GitHub, there are a few small differences:
* In the GitHub environment, the `GITHUB_TOKEN` is passed to all actions by default. This is not the case in the local environment, but can be achieved by creating a [personal token](https://github.com/settings/tokens/new?scopes=repo&description=GHA) and supplying it as a secret (see above).
* The `/github/home` volume in the container is tied to your local directory `/tmp/gh-home`. In GitHub, this directory is container-specific, whereas this script shares it between all containers.
## Development
@ -50,7 +58,3 @@ to add:
- [ ] Add support for local Docker images: [`./path/to/dir`](https://developer.github.com/actions/creating-workflows/workflow-configuration-options/#using-a-dockerfile-image-in-an-action)
- [ ] Add support for Docker Hub images: [`docker://{image}:{tag}`](https://developer.github.com/actions/creating-workflows/workflow-configuration-options/#using-a-dockerfile-image-in-an-action)
- [ ] Add support for custom hosted Docker images: [`docker://{host}/{image}:{tag}`](https://developer.github.com/actions/creating-workflows/workflow-configuration-options/#using-a-dockerfile-image-in-an-action)
Some improvements are also possible in other areas:
- [ ] Add support for default [`GITHUB_TOKEN`](https://developer.github.com/actions/creating-workflows/storing-secrets/#github-token-secret) env var

View File

@ -130,6 +130,10 @@ const runAction = (actionTitle, actions, event, verbose) => {
})
}
if ('GITHUB_TOKEN' in process.env && !('GITHUB_TOKEN' in action.env)) {
action.env.GITHUB_TOKEN = process.env.GITHUB_TOKEN
}
const uses = action.uses
const imageName = resolveRunner(uses, verbose)
let args = []