Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,40 @@ name: Package test
on:
pull_request:
issue_comment:
types: [created] # run when comment added with just "📦"
types: [created] # run when comment added with "📦"

env:
GITHUB_TOKEN: ${{ github.token }}

permissions:
contents: read
pull-requests: write

jobs:
# run package test on pull request event
package:
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'issue_comment' && github.event.issue.pull_request != null && github.event.comment.body == '📦') }}
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ format('refs/pull/{0}/merge', github.event.pull_request.number || github.event.issue.number) }}

- id: get_pr
if: ${{ github.event_name == 'issue_comment' }}
uses: actions/github-script@v6
- name: Diff and review changed/added packages
uses: kaste/st_package_reviewer/gh_action@7dd94a9f77ab03d7a7a412ae88132076c66cf5ff
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.issue.number
});
core.setOutput('base_sha', pr.data.base.sha);
core.setOutput('head_sha', pr.data.head.sha);
pr: ${{ github.event.pull_request.html_url }}
file: repository.json

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