Skip to content

Commit d22ae6b

Browse files
author
magisk317
committed
ci: check marketplace workflow access
1 parent bd86a3d commit d22ae6b

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,25 @@ jobs:
5858
}
5959
}
6060
core.setFailed('marketplace fork not ready');
61+
- if: ${{ env.MARKETPLACE_PR_TOKEN != '' }}
62+
name: Check marketplace workflow access
63+
uses: actions/github-script@v7
64+
with:
65+
github-token: ${{ env.MARKETPLACE_PR_TOKEN }}
66+
script: |
67+
const forkOwner = context.actor;
68+
const repo = 'marketplace';
69+
const path = '.github/workflows/validate-pr.yml';
70+
try {
71+
await github.rest.repos.getContent({ owner: forkOwner, repo, path });
72+
return;
73+
} catch (error) {
74+
if (error.status === 404) {
75+
core.setFailed('Marketplace fork missing .github/workflows/validate-pr.yml. Sync the fork or use a token with workflow scope to allow pushing workflow files.');
76+
return;
77+
}
78+
throw error;
79+
}
6180
- if: ${{ env.MARKETPLACE_PR_TOKEN != '' }}
6281
uses: actions/checkout@v4
6382
with:

0 commit comments

Comments
 (0)