Skip to content

Commit

Permalink
Quote api.grai.io
Browse files Browse the repository at this point in the history
  • Loading branch information
edlouth committed Jun 15, 2023
1 parent 1f3fe00 commit 776c1e1
Showing 1 changed file with 22 additions and 29 deletions.
51 changes: 22 additions & 29 deletions base_readme.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,50 @@
# Grai Actions


## Shared Fields

All actions share some common fields listed below.


### Authentication

| Field | Required | Default | Description |
|--------------------|----------|---------------------|--------------------------|
| api-key | no | | Your Grai API key. |
| grai-user | no | | Your Grai username. |
| grai-password | no | | Your Grai password. |
| workspace | no | | Your Grai workspace name |
| Field | Required | Default | Description |
| ------------- | -------- | ------- | ------------------------ |
| api-key | no | | Your Grai API key. |
| grai-user | no | | Your Grai username. |
| grai-password | no | | Your Grai password. |
| workspace | no | | Your Grai workspace name |

You must provider either `api-key` or `grai-user` **and** `grai-password`.
If you're account is associated with multiple workspaces and you're using username/password authentication you must
If you're account is associated with multiple workspaces and you're using username/password authentication you must
also provide your desired `workspace`.


### Other Parameters

| Field | Required | Default | Description |
|----------------|----------|---------------------|-------------------------------------------------------------------------------------------------------------|
| namespace | yes | | The Grai namespace for the connection |
| grai-api-url | no | https://api.grai.io | "The url of your grai instance. This is constructed as {scheme}://{host}:{port} where the port is optional" |
| grai-app-url | no | https://app.grai.io | The URL for your frontend instance of Grai. This might include a port depending on your configuration |
| action | no | tests | Which action to perform. Can be `tests` or `update` |
| github-token | no | `${{github.token}}` | The GITHUB_TOKEN secret for your repository |

| Field | Required | Default | Description |
| ------------ | -------- | --------------------- | ----------------------------------------------------------------------------------------------------------- |
| namespace | yes | | The Grai namespace for the connection |
| grai-api-url | no | `https://api.grai.io` | "The url of your grai instance. This is constructed as {scheme}://{host}:{port} where the port is optional" |
| grai-app-url | no | `https://app.grai.io` | The URL for your frontend instance of Grai. This might include a port depending on your configuration |
| action | no | `tests` | Which action to perform. Can be `tests` or `update` |
| github-token | no | `${{github.token}}` | The GITHUB_TOKEN secret for your repository |

## Notes and Caveats

### Github Authentication

By default we use a `github-token` provided by your repository to write comments back to your PR with test results.
In some cases, such as when the pull request is coming from a forked repository, the default token will not have write
By default we use a `github-token` provided by your repository to write comments back to your PR with test results.
In some cases, such as when the pull request is coming from a forked repository, the default token will not have write
permissions.
If this is the case, you'll receive an error message in the workflow indicating such.
There are a few ways you can resolve the issue but you should first check your repository action settings under
`Settings -> Actions -> General` aren't blocking workflows from running.


Some alternatives include.

#### Explicit Workflow Permissions

GitHub has provided helpful [documentation](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs)
to provide explicit permissions for your workflows.
Make sure the Grai Action has, at minimum, write permissions for `pull-request` and `issues`.
to provide explicit permissions for your workflows.
Make sure the Grai Action has, at minimum, write permissions for `pull-request` and `issues`.
You can set this at the job level by adding a `permission` key in your workflow. e.g.

```yaml copy
Expand All @@ -60,7 +55,6 @@ jobs:
permissions:
issues: write
pull-requests: write

```
#### Personal Access Tokens
Expand All @@ -71,18 +65,17 @@ You'll need to create a token following the linked instructions but make sure to
`Settings -> Secrets and variables -> Actions -> New Repository Secret`.
If you were to create a secret called `MY_PAT` you would pass it into your grai action job as

````yaml copy
```yaml copy
jobs:
my-grai-action:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run Grai Action
uses: grai-io/grai-actions/redshift@master
with:
github-token: ${{ secrets.MY_PAT }}
````

```

0 comments on commit 776c1e1

Please sign in to comment.