#GitHub Actions - Can I push to private repo (ghcr) without creating a PAT?

1 messages · Page 1 of 1 (latest)

fresh magnet
#

On second thought, it is of course almost impossible to create a setup that works both locally as well as remotely without such a Personal Access Token. I wish it could somehow integrate with the GH_TOKEN but I found that very hard to figure out.

#

Does "dagger/dagger-for-github@v5" support GH_TOKEN?

ivory marten
#

you can setup the pipeline in a way that when you running locally it uses the PAT and when you run it in Github Actions, make it use the GITHUB_TOKEN

fresh magnet
#

Hey! wow!

#

It is working now

#

I had to add the repo to the package. This is an additional step you gotta do apparently. Before this I was hitting "403 Forbidden" errors.

#
name: dagger_demo.yaml
permissions:
  contents: read
  packages: write
on:
  push:
    branches:
      - demo
jobs:
  build:
    name: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: 'Install dagger-io'
        run: pip install dagger-io
      - name: 'Run Dagger pipeline'
        uses: dagger/dagger-for-github@v5
        with:
          workdir: apps/demo
          verb: run
          args: python main.py "${{ secrets.GITHUB_TOKEN }}" "${{ github.actor }}"
          version: "0.9.3"
``` * updated based on comments below
#

Thank you for your help! @ivory marten ! i'm happy to know that there is a way to do this!

ivory marten
#

that's great! happy hacking and we're here to help in any way we can! 💪 daggerfire

mortal bloom
ivory marten
#

Also I think installing anyio is not required since the Dagger SDK already requires it

ivory marten
#

also, seems like setup-go is irrelevant there?

fresh magnet
#

Many thanks @mortal bloom @ivory marten, 🙏 I have updated the code based on your comments. It still works fine! 🤗