@@ -12,35 +12,32 @@ jobs:
1212 runs-on : ubuntu-latest
1313
1414 steps :
15- - name : Checkout main branch
15+ - name : Checkout main
1616 uses : actions/checkout@v4
1717 with :
1818 ref : main
19- token : ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
20- persist-credentials : true
2119 fetch-depth : 0
20+ token : ${{ secrets.PAT_TOKEN }} # ✅ proven token that works
2221
23- # 🧩 Configure Git credentials and remote
24- - name : Configure Git auth
22+ - name : Configure Git for push
2523 run : |
26- git config --global user.name "github-actions[bot]"
27- git config --global user.email "github-actions[bot]@users.noreply.github.com"
28- git remote set-url origin "https://${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
29- echo "✅ Git authentication configured."
24+ git config user.name "github-actions[bot]"
25+ git config user.email "github-actions[bot]@users.noreply.github.com"
26+ git remote set-url origin "https://${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}.git"
3027
3128 - name : Prepare or reuse generated-template branch
3229 id : prepare_branch
3330 run : |
3431 BRANCH="generated-template"
3532 git fetch origin
3633 if git show-ref --verify --quiet refs/remotes/origin/$BRANCH; then
37- echo "Branch exists — checking out and pulling latest ."
34+ echo "Branch exists — checking it out ."
3835 git checkout $BRANCH
3936 git pull origin $BRANCH
4037 else
41- echo "Branch does not exist — creating new one ."
38+ echo "Branch does not exist — creating it ."
4239 git checkout -b $BRANCH
43- git push --set-upstream origin $BRANCH
40+ git push -u origin $BRANCH
4441 fi
4542 echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
4643
5451 run : |
5552 rsync -a --delete --exclude='.git' ./example-template/ ./{{cookiecutter.app_name}}/
5653
57- - name : Debug Git remote info
58- run : |
59- git remote -v
60- git branch --show-current
61- git status
62-
6354 - name : Commit and push changes
6455 id : commit
6556 run : |
@@ -73,33 +64,11 @@ jobs:
7364 echo "no_changes=false" >> $GITHUB_OUTPUT
7465 fi
7566
76- # 🧪 Verify that the commit is visible on GitHub
77- - name : Verify commit visibility
78- if : steps.commit.outputs.no_changes == 'false'
79- run : |
80- echo "🧾 Local HEAD commit:"
81- git log -1 --oneline
82-
83- echo "⏳ Waiting a few seconds for GitHub to index the push..."
84- sleep 5
85-
86- git fetch origin generated-template
87- echo "🧾 Remote branch HEAD:"
88- git log origin/generated-template -1 --oneline
89-
90- LOCAL_SHA=$(git rev-parse HEAD)
91- REMOTE_SHA=$(git rev-parse origin/generated-template)
92- if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
93- echo "✅ Verified: commit is on GitHub."
94- else
95- echo "⚠️ Warning: commit not yet visible remotely (may take a few seconds)."
96- fi
97-
98- - name : Create or Update Pull Request
67+ - name : Create or update Pull Request
9968 if : steps.commit.outputs.no_changes == 'false'
10069 uses : peter-evans/create-pull-request@v7
10170 with :
102- token : ${{ secrets.GITHUB_TOKEN }}
71+ token : ${{ secrets.PAT_TOKEN }} # ✅ use same working PAT
10372 base : main
10473 branch : ${{ steps.prepare_branch.outputs.branch }}
10574 title : " ci: update generated cookiecutter template from example"
0 commit comments