Estou tentando espelhar um repositório público pertencente à minha organização no GitHub (sou administrador da organização) para um repositório privado na minha conta pessoal. Fiz o seguinte:
- Criei um token de acesso granular com muitas permissões (fiquei um pouco desesperado)
Read and Write access to Dependabot alerts, actions, actions variables, administration, attestations api, code, codespaces, codespaces lifecycle admin, codespaces secrets, commit statuses, dependabot secrets, deployments, discussions, environments, issues, merge queues, pages, pull requests, repository advisories, repository custom properties, repository hooks, secret scanning alerts, secrets, security events, and workflows
- Verifiquei 100x se o token tem acesso ao meu repositório privado pessoal
- Fluxos de trabalho habilitados para execução no meu repositório pessoal:
Mas continuo vendo o erro:
> Run git remote add private
> https://***@github.com/xxxx.git
> origin https://github.com/yyyy (fetch)
> origin https://github.com/yyyy (push)
> private https://***@github.com/xxxx.git
> (fetch)
> private https://***@github.com/xxxx.git
> (push) remote: Permission to xxxx.git
> denied to github-actions[bot]. fatal: unable to access
> 'https://github.com/xxxx/': The
> requested URL returned error: 403 Error: Process completed with exit
> code 128.
Minha ação no github é definida da seguinte forma:
name: Mirror Repository
on:
push:
branches: [main]
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
mirror:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Push to private mirror
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
git remote add private https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/xxxx.git
# Debug: List remotes to verify
git remote -v
git push private --force --all
git push private --force --tags
Alguém pode me ajudar? Estou sem ideias.