Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

# Run a local registry
services:
registry:
Expand All @@ -51,8 +55,6 @@ jobs:
- name: Push To
id: push_to
shell: python
env:
HAS_GHA_CR_TOKEN: ${{ secrets.GHA_CR_TOKEN != '' }}
run: |
import os

Expand All @@ -63,22 +65,25 @@ jobs:

gh_repo = g('GITHUB_REPOSITORY')
gh_event = g('GITHUB_EVENT_NAME')
has_cr_token = g('HAS_GHA_CR_TOKEN')

i = []

print("Adding local service.")
i.append("localhost:5000/"+gh_repo)

if gh_event == 'push' and has_cr_token == 'true':
# Use GITHUB_TOKEN for authentication (always available)
if gh_event == 'push':
print("Adding GitHub Container Repository (ghcr.io)")
i.append("ghcr.io/{}/image".format(gh_repo))
else:
print("Skipping GitHub Container Repository (ghcr.io)")
print("Skipping GitHub Container Repository (ghcr.io) for non-push events")

l = ",".join(i)
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name l (lowercase L) is ambiguous and easily confused with the number 1 or uppercase I. Consider renaming it to something more descriptive like locations or images_list.

Copilot uses AI. Check for mistakes.
print("Final locations:", repr(l))
print("::set-output name=images::{}".format(l))

# Use environment file instead of deprecated set-output
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write("images={}\n".format(l))

- name: Docker meta
id: docker_meta
Expand All @@ -97,11 +102,11 @@ jobs:

- name: Login to GHCR
if: ${{ contains(steps.push_to.outputs.images, 'ghcr.io') }}
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.GHA_CR_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Login to local registry
# uses: docker/login-action@v1
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,6 @@ cython_debug/
# Generated version file
actions_includes/version.py
docker/*.tar.gz

# Git worktrees
.worktrees/
Loading