Skip to content

Commit

Permalink
Update index.md for GITHUB_TOKEN and gh cli note
Browse files Browse the repository at this point in the history
See nektos/act/#1831
  • Loading branch information
StevenACoffman authored Jun 19, 2023
1 parent 6871408 commit d7a4f8b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/beginner/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,19 @@ When inserting sensitive data in your terminal, it might be saved as plain text

### `GITHUB_TOKEN`

GitHub Actions provides `secrets.GITHUB_TOKEN` and `github.token` automatically, on which many actions rely. This is possible to do so in `act`, if you use set it as a secret (`GITHUB_TOKEN=ghp_...`).
If your workflow fails with an error about `token`, it most likely requires `GITHUB_TOKEN` to be set up.
GitHub [automatically provides](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret) a `GITHUB_TOKEN` secret when running workflows inside GitHub. If your workflow fails with an error about `token`, it most likely requires `GITHUB_TOKEN` to be set up.
If your workflow depends on this token, you need to create a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) and pass it to `act` as a secret:
```bash
act -s GITHUB_TOKEN=[insert token or leave blank and omit equals for secure input]
```

If [GitHub CLI](https://cli.github.com/) is installed, the [`gh auth token`](https://cli.github.com/manual/gh_auth_token) command can be used to autmatically pass the token to act

```bash
act -s GITHUB_TOKEN="$(gh auth token)"
```

**WARNING**: `GITHUB_TOKEN` will be logged in shell history if not inserted through secure input or (depending on your shell config) the command is prefixed with a whitespace.

## `.env`/`.secrets` files structure

Expand Down Expand Up @@ -263,4 +274,4 @@ Similarly if we just wanted to trigger this workflow for node 10 and macos-lates
This will trigger the workflow to use the following matrix configurations only:
- `os: macos-latest, node 10`

Note that using the `--matrix` flag you can't add new values (for e.g. running the above workflow for node 20). It will simply ignore it. Moreover, the `exclude` field in the workflow will take precedance over the `--matrix` flag (for e.g. running the above workflow for only macos-latest and node 4 will result in no matrix configuration being used)
Note that using the `--matrix` flag you can't add new values (for e.g. running the above workflow for node 20). It will simply ignore it. Moreover, the `exclude` field in the workflow will take precedance over the `--matrix` flag (for e.g. running the above workflow for only macos-latest and node 4 will result in no matrix configuration being used)

0 comments on commit d7a4f8b

Please sign in to comment.