Skip to content

Commit f51682f

Browse files
committed
Check repo owner ID instead of repo name
1 parent a360fcb commit f51682f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,17 @@ runs:
113113
# https://github.com/actions/runner/issues/2473
114114
REF=${{ env.ACTION_REF || env.PR_REF || github.ref_name }}
115115
REPO=${{ env.ACTION_REPO || env.PR_REPO || github.repository }}
116+
REPO_OWNER_ID=${{ env.PR_REPO_OWNER_ID || github.repository_owner_id }}
116117
echo "ref=$REF" >>"$GITHUB_OUTPUT"
117118
echo "repo=$REPO" >>"$GITHUB_OUTPUT"
119+
echo "repo-owner-id=$REPO_OWNER_ID" >>"$GITHUB_OUTPUT"
118120
shell: bash
119121
env:
120122
ACTION_REF: ${{ github.action_ref }}
121123
ACTION_REPO: ${{ github.action_repository }}
122124
PR_REF: ${{ github.event.pull_request.head.ref }}
123125
PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
126+
PR_REPO_OWNER_ID: ${{ github.event.pull_request.base.repo.owner.id }}
124127
- name: Check out action repo
125128
uses: actions/checkout@v4
126129
with:
@@ -135,6 +138,7 @@ runs:
135138
EVENT: ${{ github.event_name }}
136139
REF: ${{ steps.set-repo-and-ref.outputs.ref }}
137140
REPO: ${{ steps.set-repo-and-ref.outputs.repo }}
141+
REPO_OWNER_ID: ${{ steps.set-repo-and-ref.outputs.repo-owner-id }}
138142
shell: bash
139143
working-directory: action-repo
140144
- name: Run Docker container

create-docker-action.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@
88
EVENT = os.environ['EVENT']
99
REF = os.environ['REF']
1010
REPO = os.environ['REPO']
11+
REPO_OWNER_ID = os.environ['REPO_OWNER_ID']
12+
REPO_OWNER_ID_PYPA = '647025'
1113

1214

13-
def set_image(event: str, ref: str, repo: str) -> str:
14-
if event == 'pull_request' and 'gh-action-pypi-publish' in repo:
15+
def set_image(event: str, ref: str, repo: str, repo_owner_id: str) -> str:
16+
if event == 'pull_request' and repo_owner_id == REPO_OWNER_ID_PYPA:
1517
return '../../../Dockerfile'
1618
docker_ref = ref.replace('/', '-')
1719
return f'docker://ghcr.io/{repo}:{docker_ref}'
1820

1921

20-
image = set_image(EVENT, REF, REPO)
22+
image = set_image(EVENT, REF, REPO, REPO_OWNER_ID)
2123

2224
action = {
2325
'name': '🏃',

0 commit comments

Comments
 (0)