Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e1086de

Browse files
aj3shsugat009
andauthored
docs: add github action permissions on README (#75)
Co-authored-by: Sugat Bajracharya <30311933+sugat009@users.noreply.github.com>
1 parent bfc1293 commit e1086de

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

‎README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,42 @@ name: Conventional Commitlint
3232

3333
on:
3434
push:
35-
branches: ['main']
35+
branches: ["main"]
3636
pull_request:
3737

3838
jobs:
3939
commitlint:
4040
runs-on: ubuntu-latest
4141
name: Conventional Commitlint
42+
permissions:
43+
contents: read
44+
pull-requests: read
4245
steps:
4346
- name: Conventional Commitlint
4447
uses: opensource-nepal/commitlint@v1
4548
```
4649
4750
> **_Note:_** The `commitlint` GitHub Action is triggered only by `push`, `pull_request`, or `pull_request_target` events.
4851

52+
#### GitHub Action Permissions
53+
54+
The action requires read permission for the following scopes:
55+
56+
- `contents: read` : This allows the action to list commits of the repository.
57+
- `pull-requests: read` : This allows the action to list the commits in a Pull Request.
58+
59+
For public repositories, these permissions are granted by default.
60+
For private repositories, you must explicitly grant them, either in:
61+
62+
- the [repository’s default workflow permissions](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-default-github_token-permissions), or
63+
- the [workflow/job permissions block](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions)
64+
65+
Without these, you may encounter an error like:
66+
67+
```
68+
Github API failed with status code 403. Response: {'message': 'Resource not accessible by integration', 'documentation_url': 'https://docs.github.com/rest/pulls/pulls#list-commits-on-a-pull-request', 'status': '403'}
69+
```
70+
4971
#### GitHub Action Inputs
5072

5173
| # | Name | Type | Default | Description |

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /