Github secrets defined in forked repo are not accessible in same repo

Hi experts,

I have a forked repo. I am trying to create a Github workflow that creates a snap package and upload it. I use snapcore/action-publish action to publish my snap. It requires env var SNAPCRAFT_STORE_CREDENTIALS which I have stored as repository secret in my repo. But the issue is because secret is not accessible, publish steps fails. Please make note that I have added secrets in forked repo and not in upstream as I know that secrets from upstream repo is not available in fork.

Here is a yaml.

name: Snap

on:
  push:
    tags:
      - "*"

jobs:
  create-snap:
    name: Create snap
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source
        uses: actions/checkout@v3
      - name: Build snap
        uses: snapcore/action-build@v1
        id: build-snap
      - name: Print secret
        run: |
            echo "This is secret"
            echo ${{ secrets.MAC_NAME }}
      - name: Publish snap
        uses: snapcore/action-publish@v1
        env:
          SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
        with:
          snap: ${{ steps.build-snap.outputs.snap }}
          release: edge

echo ${{ secrets.MAC_NAME }} is also not printing anything.

Please help.

It is solved now. It required clone and push using SSH keys instead of regular username and personal token.

Thanks for coming back and updating the discussion. :slight_smile: This might help others with similar query.