Skip to content

chore: Added workflow for Plugin PRs to create zip for testing #25

chore: Added workflow for Plugin PRs to create zip for testing

chore: Added workflow for Plugin PRs to create zip for testing #25

name: Plugin Artifact for PR
on:
pull_request:
paths:
- 'plugins/**'
jobs:
create-plugin-artifact:
name: Create Plugin Artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changed plugin directory
id: plugin
run: |
plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/' | head -1 | cut -d/ -f2)
echo "slug=$plugin" >> $GITHUB_OUTPUT
- name: Create HWP Previews plugin artifact
uses: ./.github/actions/create-plugin-artifact
with:
slug: ${{ steps.plugin.outputs.slug }}
- name: Comment with artifact link
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request;
const runId = context.runId;
const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}`;
const body = `ℹ️ [Download the ${{ steps.plugin.outputs.slug }} plugin artifact from this workflow run](${artifactUrl}) (see the 'Artifacts' section at the bottom).`;
await github.rest.issues.createComment({
issue_number: pr.number,
owner: context.repo.owner,
repo: context.repo.repo,
body
});