Skip to content

Commit d1a418a

Browse files
committed
🐛 add repo push
1 parent 50d2d2a commit d1a418a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/python-publish.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,23 @@ jobs:
4242
# Commit metadata back to repo
4343
- name: Commit and push metadata
4444
env:
45-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
REPO_PUSH_TOKEN: ${{ secrets.REPO_PUSH_TOKEN }}
4646
run: |
4747
git config --global user.name "github-actions[bot]"
4848
git config --global user.email "github-actions[bot]@users.noreply.github.com"
4949
50+
# Fetch and switch to main branch
5051
git fetch origin main
5152
git checkout main
5253
53-
# Re-authenticate remote with GITHUB_TOKEN explicitly
54-
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
55-
54+
# Add metadata files
5655
git add metadata/
56+
57+
# Commit only if changes exist
5758
if ! git diff --cached --quiet; then
5859
git commit -m ":bookmark: Update metadata after release"
59-
git push origin main
60+
# Push using the PAT token
61+
git push https://x-access-token:${REPO_PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git main
6062
else
6163
echo "No changes to commit"
6264
fi

0 commit comments

Comments
 (0)