Skip to content

Commit a233090

Browse files
committed
Merge branch 'master' into feature/add-api-key-ui-plugin
2 parents c16711d + 8c8fb3b commit a233090

1 file changed

Lines changed: 29 additions & 18 deletions

File tree

.github/workflows/validate-plugin-toml.yml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
- 'plugins/**'
99

1010
permissions:
11+
contents: read
12+
issues: write
1113
pull-requests: write
1214

1315
jobs:
@@ -72,28 +74,37 @@ jobs:
7274
body = marker + '\n## Plugin TOML Validation Report\n\n> No validation report generated.';
7375
}
7476
75-
const { data: comments } = await github.rest.issues.listComments({
76-
owner: context.repo.owner,
77-
repo: context.repo.repo,
78-
issue_number: context.issue.number,
79-
});
80-
81-
const existing = comments.find(c => c.body && c.body.includes(marker));
82-
83-
if (existing) {
84-
await github.rest.issues.updateComment({
85-
owner: context.repo.owner,
86-
repo: context.repo.repo,
87-
comment_id: existing.id,
88-
body,
89-
});
90-
} else {
91-
await github.rest.issues.createComment({
77+
try {
78+
const { data: comments } = await github.rest.issues.listComments({
9279
owner: context.repo.owner,
9380
repo: context.repo.repo,
9481
issue_number: context.issue.number,
95-
body,
9682
});
83+
84+
const existing = comments.find(c => c.body && c.body.includes(marker));
85+
86+
if (existing) {
87+
await github.rest.issues.updateComment({
88+
owner: context.repo.owner,
89+
repo: context.repo.repo,
90+
comment_id: existing.id,
91+
body,
92+
});
93+
} else {
94+
await github.rest.issues.createComment({
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
issue_number: context.issue.number,
98+
body,
99+
});
100+
}
101+
} catch (error) {
102+
if (error.status === 403) {
103+
core.warning(`Skipping PR comment because the workflow token cannot write comments: ${error.message}`);
104+
return;
105+
}
106+
107+
throw error;
97108
}
98109
99110
- name: Fail if validation failed

0 commit comments

Comments
 (0)