Skip to content

Commit

Permalink
Check repo ID instead of repo owner ID
Browse files Browse the repository at this point in the history
  • Loading branch information
br3ndonland committed Nov 4, 2024
1 parent f51682f commit 7ea8313
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ runs:
# https://github.com/actions/runner/issues/2473
REF=${{ env.ACTION_REF || env.PR_REF || github.ref_name }}
REPO=${{ env.ACTION_REPO || env.PR_REPO || github.repository }}
REPO_OWNER_ID=${{ env.PR_REPO_OWNER_ID || github.repository_owner_id }}
REPO_ID=${{ env.PR_REPO_ID || github.repository_id }}
echo "ref=$REF" >>"$GITHUB_OUTPUT"
echo "repo=$REPO" >>"$GITHUB_OUTPUT"
echo "repo-owner-id=$REPO_OWNER_ID" >>"$GITHUB_OUTPUT"
echo "repo-id=$REPO_ID" >>"$GITHUB_OUTPUT"
shell: bash
env:
ACTION_REF: ${{ github.action_ref }}
ACTION_REPO: ${{ github.action_repository }}
PR_REF: ${{ github.event.pull_request.head.ref }}
PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
PR_REPO_OWNER_ID: ${{ github.event.pull_request.base.repo.owner.id }}
PR_REPO_ID: ${{ github.event.pull_request.base.repo.id }}
- name: Check out action repo
uses: actions/checkout@v4
with:
Expand All @@ -138,7 +138,7 @@ runs:
EVENT: ${{ github.event_name }}
REF: ${{ steps.set-repo-and-ref.outputs.ref }}
REPO: ${{ steps.set-repo-and-ref.outputs.repo }}
REPO_OWNER_ID: ${{ steps.set-repo-and-ref.outputs.repo-owner-id }}
REPO_ID: ${{ steps.set-repo-and-ref.outputs.repo-id }}
shell: bash
working-directory: action-repo
- name: Run Docker container
Expand Down
10 changes: 5 additions & 5 deletions create-docker-action.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
EVENT = os.environ['EVENT']
REF = os.environ['REF']
REPO = os.environ['REPO']
REPO_OWNER_ID = os.environ['REPO_OWNER_ID']
REPO_OWNER_ID_PYPA = '647025'
REPO_ID = os.environ['REPO_ID']
REPO_ID_GH_ACTION = '178055147'


def set_image(event: str, ref: str, repo: str, repo_owner_id: str) -> str:
if event == 'pull_request' and repo_owner_id == REPO_OWNER_ID_PYPA:
def set_image(event: str, ref: str, repo: str, repo_id: str) -> str:
if event == 'pull_request' and repo_id == REPO_ID_GH_ACTION:
return '../../../Dockerfile'
docker_ref = ref.replace('/', '-')
return f'docker://ghcr.io/{repo}:{docker_ref}'


image = set_image(EVENT, REF, REPO, REPO_OWNER_ID)
image = set_image(EVENT, REF, REPO, REPO_ID)

action = {
'name': '🏃',
Expand Down

0 comments on commit 7ea8313

Please sign in to comment.