Skip to content

Commit 799e7f3

Browse files
authored
use the_crawl-based package reviewer (#9246)
* the_crawl based package reviewer by @kaste * less strict 📦 comment check * set GITHUB_TOKEN in env and permissions * access the pr url via issue_comment > issue > pr
1 parent 88b4071 commit 799e7f3

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

.github/workflows/package.yml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,40 @@ name: Package test
33
on:
44
pull_request:
55
issue_comment:
6-
types: [created] # run when comment added with just "📦"
6+
types: [created] # run when comment added with "📦"
7+
8+
env:
9+
GITHUB_TOKEN: ${{ github.token }}
10+
11+
permissions:
12+
contents: read
13+
pull-requests: write
714

815
jobs:
16+
# run package test on pull request event
917
package:
10-
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'issue_comment' && github.event.issue.pull_request != null && github.event.comment.body == '📦') }}
18+
if: ${{ github.event_name == 'pull_request' }}
1119
runs-on: ubuntu-latest
1220
steps:
1321
- uses: actions/checkout@v5
1422
with:
1523
fetch-depth: 0
16-
ref: ${{ format('refs/pull/{0}/merge', github.event.pull_request.number || github.event.issue.number) }}
17-
18-
- id: get_pr
19-
if: ${{ github.event_name == 'issue_comment' }}
20-
uses: actions/github-script@v6
24+
- name: Diff and review changed/added packages
25+
uses: kaste/st_package_reviewer/gh_action@7dd94a9f77ab03d7a7a412ae88132076c66cf5ff
2126
with:
22-
script: |
23-
const pr = await github.rest.pulls.get({
24-
owner: context.repo.owner,
25-
repo: context.repo.repo,
26-
pull_number: context.payload.issue.number
27-
});
28-
core.setOutput('base_sha', pr.data.base.sha);
29-
core.setOutput('head_sha', pr.data.head.sha);
27+
pr: ${{ github.event.pull_request.html_url }}
28+
file: repository.json
3029

31-
# latest version on simplify branch see #5
32-
# https://github.com/packagecontrol/st-package-reviewer-action/pull/5
33-
- uses: packagecontrol/st-package-reviewer-action@de58167cfca93775fcbf5061cce6e452b51ce7b6
30+
# run package test on demand via comment on the pr
31+
package_comment:
32+
if: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request != null && contains(github.event.comment.body, '📦') }}
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v5
36+
with:
37+
fetch-depth: 0
38+
- name: Diff and review changed/added packages
39+
uses: kaste/st_package_reviewer/gh_action@7dd94a9f77ab03d7a7a412ae88132076c66cf5ff
3440
with:
35-
base-sha: ${{ github.event.pull_request.base.sha || steps.get_pr.outputs.base_sha }}
36-
current-sha: ${{ github.event.pull_request.head.sha || steps.get_pr.outputs.head_sha }}
41+
pr: ${{ github.event.issue.pull_request.html_url }}
42+
file: repository.json

0 commit comments

Comments
 (0)