Skip to content

Commit d198906

Browse files
authored
feat!: make token required (#180)
* fix(cp-update): make token required to convince users to pass a PAT * docs(cp-update): fix readme * docs(cp-update): add correct permissions to readme
1 parent 5da6246 commit d198906

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

create-plugin-update/README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ This GitHub Action automates the process of running `create-plugin update` withi
1010

1111
## Usage
1212

13+
Detailed setup instructions can be found in the [Grafana developer portal](https://grafana.com/developers/plugin-tools/set-up/set-up-github#the-create-plugin-update-workflow).
14+
1315
- Add a workflow to your Github repository as in the example below.
14-
- Set up the necessary secrets. As this action will push to and open a PR in the plugins repository make sure the token you supply has the correct privileges.
16+
- Set up the necessary secrets. As this action will push to and open a PR in the plugins repostory create a fine-grained personal access token for your repository with `contents: read and write`, `pull requests: read and write` and `workflows: read and write` and pass it to the action.
1517

1618
## Workflow example
19+
1720
<!-- x-release-please-start-version -->
1821

1922
```yaml
@@ -22,28 +25,23 @@ name: Create Plugin Update
2225
on:
2326
workflow_dispatch:
2427
schedule:
25-
- cron: '0 0 1 * *' # run once a month on the 1st day
26-
27-
# To use the default github token with the following elevated permissions make sure to check:
28-
# **Allow GitHub Actions to create and approve pull requests** in https://github.com/USER_NAME/REPO_NAME/settings/actions.
29-
# Alternatively create a fine-grained personal access token for your repository with `contents: read and write` and `pull requests: read and write` and pass it to the action.
30-
31-
permissions:
32-
contents: write
33-
pull-requests: write
28+
- cron: "0 0 1 * *" # run once a month on the 1st day
3429

3530
jobs:
3631
release:
3732
runs-on: ubuntu-latest
3833
steps:
3934
- uses: grafana/plugin-actions/create-plugin-update@create-plugin-update/v1.1.0
35+
with:
36+
token: ${{ secrets.GH_PAT_TOKEN }}
4037
```
38+
4139
<!-- x-release-please-end-version -->
4240
4341
## Options
4442
4543
The following options can be passed to this action:
4644
47-
- `token`: A github token with write access to pull requests and content (defaults to `github.token`).
45+
- `token`: A github token with write access to `pull requests`, `content` and `workflows` (**required**).
4846
- `base`: The base branch to open the pull request against (defaults to `main`).
4947
- `node-version`: The version of node to use (defaults to `20`).

create-plugin-update/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ description: "Runs create-plugin update within a Grafana plugin and opens a PR w
44
inputs:
55
token:
66
description: "Token for the repository. Can be passed in using `{{ secrets.GITHUB_TOKEN }}`."
7-
required: false
8-
default: "${{ github.token }}"
7+
required: true
98
base:
109
description: "Sets the pull request base branch"
1110
required: false

0 commit comments

Comments
 (0)