Skip to content

Failed to push ghcr.io 403 Forbidden #1373

Closed
@bbhtt

Description

@bbhtt

Contributing guidelines

I've found a bug, and:

  • The documentation does not mention anything about my problem
  • There are no open or closed issues that are related to my problem

Description

Pushing the image from CI to GHCR fails with 403 forbidden

Expected behaviour

Pushing should work

Actual behaviour

403 forbidden

Repository URL

https://github.com/bbhtt/flatpak-external-data-checker

Workflow run URL

https://github.com/bbhtt/flatpak-external-data-checker/actions/runs/14952141280/job/42003050857

0_Build image.txt

YAML workflow

name: Push image

on:
  pull_request:
  push:
    branches:
      - master

jobs:
  image:
    name: Build image
    runs-on: ubuntu-latest
    permissions: write-all
    steps:

      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
        with:
          persist-credentials: false

      - name: Set up Docker Buildx
        # 3.10.0
        uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2

      - name: Login to ghcr.io
        # 3.4.0
        uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Push the images
        # 6.15.0
        uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
        if: success() && github.event_name != 'pull_request'
        with:
          context: .
          file: ./Dockerfile
          platforms: linux/amd64
          push: ${{ github.event_name != 'pull_request' }}
          provenance: false
          tags: |
            ghcr.io/${{ github.repository }}:${{ github.sha }}
            ghcr.io/${{ github.repository }}:latest
          labels: |
            org.opencontainers.image.revision=${{ github.sha }}
            org.opencontainers.image.source=ssh://git@github.com:${{ github.repository }}.git
            org.opencontainers.image.url=https://github.com/${{ github.repository }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

Workflow logs

See the link above

BuildKit logs

N/A

Additional info

Actions settings in repo:

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions