Skip to content

Commit 881cf86

Browse files
committed
fix: pr plugin promotion workflow
1 parent f542c8e commit 881cf86

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

.github/workflows/push-staging-pr-on-close.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,21 @@ on:
44
pull_request:
55
types:
66
- closed
7+
workflow_dispatch:
8+
inputs:
9+
pr_number:
10+
description: 'PR number to test with'
11+
required: true
12+
type: string
13+
pr_merged:
14+
description: 'Simulate merged PR'
15+
required: true
16+
type: boolean
17+
default: true
718

819
jobs:
920
push-staging:
10-
if: github.event.pull_request.merged == true
21+
if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch' && inputs.pr_merged == true)
1122
runs-on: ubuntu-latest
1223
permissions:
1324
contents: read
@@ -16,25 +27,36 @@ jobs:
1627
uses: szenius/set-timezone@v2.0
1728
with:
1829
timezoneLinux: "America/Los_Angeles"
19-
- name: Checkout repo
20-
uses: actions/checkout@v4
21-
with:
22-
ref: refs/pull/${{ github.event.pull_request.base.ref }}/merge
30+
31+
- name: Set PR number
32+
id: pr_number
33+
run: |
34+
if [ "${{ github.event_name }}" == "pull_request" ]; then
35+
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
36+
else
37+
echo "pr_number=${{ inputs.pr_number }}" >> $GITHUB_OUTPUT
38+
fi
2339
2440
- name: Download artifact
25-
uses: actions/download-artifact@v4
41+
uses: dawidd6/action-download-artifact@v11
2642
with:
27-
name: connect-files
43+
name_is_regexp: true
44+
name: unraid-plugin-.*
2845
path: connect-files
46+
pr: ${{ steps.pr_number.outputs.pr_number }}
47+
workflow_conclusion: success
2948

3049
- name: Update Downloaded Staging Plugin to New Date
3150
run: |
32-
if [ ! -f "connect-files/plugins/dynamix.unraid.net.pr.plg" ]; then
33-
echo "ERROR: dynamix.unraid.net.pr.plg not found"
51+
# Find the .plg file in the downloaded artifact
52+
plgfile=$(find connect-files -name "*.plg" -type f | head -1)
53+
if [ ! -f "$plgfile" ]; then
54+
echo "ERROR: .plg file not found in connect-files/"
55+
ls -la connect-files/
3456
exit 1
3557
fi
36-
37-
plgfile="connect-files/plugins/dynamix.unraid.net.pr.plg"
58+
59+
echo "Found plugin file: $plgfile"
3860
version=$(date +"%Y.%m.%d.%H%M")
3961
sed -i -E "s#(<!ENTITY version \").*(\">)#\1${version}\2#g" "${plgfile}" || exit 1
4062
@@ -54,4 +76,4 @@ jobs:
5476
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }}
5577
AWS_REGION: "auto"
5678
SOURCE_DIR: pr-release
57-
DEST_DIR: unraid-api/pr/${{ github.event.pull_request.number }}
79+
DEST_DIR: unraid-api/pr/${{ steps.pr_number.outputs.pr_number }}

0 commit comments

Comments
 (0)