File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 99 publish :
1010 runs-on : ubuntu-latest
1111 permissions :
12- contents : read
12+ contents : write
1313 pull-requests : write
1414
1515 steps :
3636 repository : d-led/conan-center-index
3737 path : conan-center-index
3838 token : ${{ secrets.GITHUB_TOKEN }}
39+ persist-credentials : true
3940
4041 - name : Setup conan-center-index upstream
4142 working-directory : conan-center-index
Original file line number Diff line number Diff line change @@ -235,9 +235,15 @@ git commit -m "Add influxdb-cpp-rest/${VERSION}
235235
236236# Push branch
237237echo " Pushing branch..."
238+ # In CI, credentials should be persisted from checkout action
239+ # If GITHUB_TOKEN is available and remote doesn't have credentials, update it
238240if [ -n " ${GITHUB_TOKEN:- } " ]; then
239- # Use token for CI environment
240- git remote set-url origin " https://${GITHUB_TOKEN} @github.com/${CONAN_INDEX_FORK} .git"
241+ # Check if remote already has credentials (from persist-credentials)
242+ CURRENT_URL=$( git remote get-url origin)
243+ if [[ ! " $CURRENT_URL " =~ @github\. com ]]; then
244+ # Remote URL doesn't have credentials, add token
245+ git remote set-url origin " https://${GITHUB_TOKEN} @github.com/${CONAN_INDEX_FORK} .git"
246+ fi
241247fi
242248git push -u origin " ${BRANCH_NAME} " || git push origin " ${BRANCH_NAME} "
243249
You can’t perform that action at this time.
0 commit comments