Skip to content

Commit d3a2dbc

Browse files
committed
Change Github Action permissions
Currently the commit-message-validator.yml Github Action raise an issue when the commit message is improper: Resource not accessible by integration Let's try if this would help. Signed-off-by: Daniel Pawlik <[email protected]>
1 parent 84c46b6 commit d3a2dbc

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

.github/workflows/commit-message-validator.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,47 @@
11
name: Check if commit message body is not too short
22

33
on:
4+
pull_request_target:
5+
types: [opened, synchronize, edited, reopened]
46
pull_request:
57
types: [opened, synchronize, edited, reopened]
68

9+
permissions: {}
10+
711
jobs:
812
verify-body-length:
913
runs-on: ubuntu-latest
1014
# set as non-voting for now.
1115
continue-on-error: true
1216

13-
permissions:
14-
contents: write
15-
pull-requests: write
16-
repository-projects: write
17-
1817
steps:
1918
- name: Checkout repository
2019
uses: actions/checkout@v4
2120
with:
2221
fetch-depth: 0
2322

23+
- name: Generate GitHub App Token
24+
id: generate_token
25+
uses: actions/create-github-app-token@v2
26+
with:
27+
app-id: ${{ secrets.COMMENTER_APP_ID }}
28+
private-key: ${{ secrets.COMMENTER_APP_PRIVATE_KEY }}
29+
owner: ${{ github.repository_owner }}
30+
repositories: |
31+
ci-framework
32+
33+
- name: Post comment
34+
uses: actions/github-script@v7
35+
with:
36+
github-token: ${{ steps.generate_token.outputs.token }}
37+
script: |
38+
github.rest.issues.createComment({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
issue_number: context.issue.number,
42+
body: 'my comment'
43+
})
44+
2445
- name: Dump commit message to file
2546
run: |
2647
git fetch origin ${{ github.event.pull_request.head.sha }}
@@ -42,3 +63,4 @@ jobs:
4263
issue-number: ${{ github.event.pull_request.number }}
4364
body-path: ./result.log
4465
reactions: confused
66+
token: ${{ steps.generate_token.outputs.token }}

0 commit comments

Comments
 (0)