Skip to content

Commit 6c08a1a

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 6c08a1a

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

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

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,46 @@
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: ci-framework
31+
32+
- name: Post comment
33+
uses: actions/github-script@v7
34+
with:
35+
github-token: ${{ steps.generate_token.outputs.token }}
36+
script: |
37+
github.rest.issues.createComment({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
issue_number: context.issue.number,
41+
body: 'my comment'
42+
})
43+
2444
- name: Dump commit message to file
2545
run: |
2646
git fetch origin ${{ github.event.pull_request.head.sha }}
@@ -42,3 +62,4 @@ jobs:
4262
issue-number: ${{ github.event.pull_request.number }}
4363
body-path: ./result.log
4464
reactions: confused
65+
token: ${{ steps.generate_token.outputs.token }}

0 commit comments

Comments
 (0)