Skip to content

Commit 3c426c2

Browse files
committed
Trying to see if we can detect changes for any sub-directory under plugins and pass this as slug for the action.
1 parent 3ee21b6 commit 3c426c2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/plugin-artifact-for-pr.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Plugin Artifact for PR
33
on:
44
pull_request:
55
paths:
6-
- 'plugins/hwp-previews/**'
7-
- 'plugins/hwp-previews-plugin/**'
6+
- 'plugins/**'
87

98
jobs:
109
create-plugin-artifact:
@@ -15,10 +14,16 @@ jobs:
1514
- name: Checkout
1615
uses: actions/checkout@v4
1716

18-
- name: Create plugin artifact
17+
- name: Get changed plugin directory
18+
id: plugin
19+
run: |
20+
plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/' | head -1 | cut -d/ -f2)
21+
echo "slug=$plugin" >> $GITHUB_OUTPUT
22+
23+
- name: Create HWP Previews plugin artifact
1924
uses: ./.github/actions/create-plugin-artifact
2025
with:
21-
slug: hwp-previews
26+
slug: ${{ steps.plugin.outputs.slug }}
2227

2328
- name: Comment with artifact link
2429
uses: actions/github-script@v7
@@ -28,7 +33,7 @@ jobs:
2833
const pr = context.payload.pull_request;
2934
const runId = context.runId;
3035
const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}`;
31-
const body = `ℹ️ [Download the plugin artifact from this workflow run](${artifactUrl}) (see the 'Artifacts' section at the bottom).`;
36+
const body = `ℹ️ [Download the ${{ steps.plugin.outputs.slug }} plugin artifact from this workflow run](${artifactUrl}) (see the 'Artifacts' section at the bottom).`;
3237
await github.rest.issues.createComment({
3338
issue_number: pr.number,
3439
owner: context.repo.owner,

0 commit comments

Comments
 (0)