File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 11name : cleanup PR
22
3- on :
4- pull_request_target :
5- types : [closed]
3+ # on:
4+ # pull_request_target:
5+ # types: [closed]
6+
7+ on : [pull_request_target]
68
79permissions : {}
810
@@ -21,21 +23,25 @@ jobs:
2123 run : |
2224 set -u
2325
24- ARTIFACTS=$(
26+ ARTIFACTS=$( \
2527 gh api \
2628 --paginate \
2729 -H "Accept: application/vnd.github+json" \
2830 -H "X-GitHub-Api-Version: 2022-11-28" \
2931 /repos/probabl-ai/skore/actions/artifacts \
30- |
31- jq -c ".artifacts[] | select(.workflow_run.head_branch == \"${BRANCH}\") | {id: .id, name: .name}"
32+ | \
33+ jq -c " \
34+ .artifacts[] \
35+ | select((.workflow_run.head_branch == \"${HEAD_BRANCH}\") and (.workflow_run.head_repository_id == \"${HEAD_REPOSITORY_ID}\")) \
36+ | {id: .id, name: .name} \
37+ " \
3238 )
3339
3440 for ARTIFACT in $ARTIFACTS; do
3541 ID=$(echo "${ARTIFACT}" | jq -r '.id')
3642 NAME=$(echo "${ARTIFACT}" | jq -r '.name')
3743
38- echo "Deleting artifact (BRANCH: \"${BRANCH }\", NAME: \"${NAME}\", ID: \"${ID}\")"
44+ echo "Deleting artifact (HEAD BRANCH: \"${HEAD_BRANCH }\", NAME: \"${NAME}\", ID: \"${ID}\")"
3945
4046 gh api \
4147 --method DELETE \
4854 GH_TOKEN : ${{ github.token }}
4955 REPOSITORY_OWNER : ${{ github.repository_owner }}
5056 REPOSITORY_NAME : ${{ github.event.repository.name }}
51- BRANCH : ${{ github.head_ref }}
57+ HEAD_REPOSITORY_ID : ${{ github.event.pull_request.head.repo.id }}
58+ HEAD_BRANCH : ${{ github.head_ref }}
5259
5360 clean-documentation-preview :
5461 if : always()
You can’t perform that action at this time.
0 commit comments