Refactor sync workflow to include token verification before removing workflow file

This commit is contained in:
b267a 2026-01-30 18:58:43 +01:00
parent 4b1406e79a
commit 0df8c3583f

View file

@ -28,9 +28,18 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Remove sync workflow and push to public repo - name: Verify token works
env: env:
GH_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }} GH_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
run: |
echo "Testing token with GitHub API..."
gh api user -q '.login' || echo "❌ Token invalid or no user scope"
echo "Testing repo access..."
gh api repos/wiestju/anny-booking-automation -q '.full_name' || echo "❌ No access to repo"
- name: Remove sync workflow and push to public repo
env:
TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
run: | run: |
# Configure git # Configure git
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
@ -43,8 +52,8 @@ jobs:
git rm .github/workflows/sync-to-public.yml git rm .github/workflows/sync-to-public.yml
git commit -m "Remove sync workflow for public repo" git commit -m "Remove sync workflow for public repo"
# Configure git to use gh for authentication # Explicitly set credentials for the public repo
gh auth setup-git git config --global credential.https://github.com.helper '!f() { echo "username=x-access-token"; echo "password=${TOKEN}"; }; f'
# Push to public repo # Push to public repo
git remote add public https://github.com/wiestju/anny-booking-automation.git git remote add public https://github.com/wiestju/anny-booking-automation.git