2727 uses : actions/checkout@v4
2828 with :
2929 ref : main
30- token : ${{ secrets.GITHUB_TOKEN }}
30+ token : ${{ secrets.PAT_TOKEN || secrets. GITHUB_TOKEN }}
3131 fetch-depth : 0
3232
3333 - name : 🏆 Update contributors list
@@ -192,82 +192,59 @@ jobs:
192192 echo "has_changes=false" >> $GITHUB_OUTPUT
193193 fi
194194
195- - name : 💾 Create Pull Request
195+ - name : 💾 Commit and Push to Main
196196 if : steps.changes.outputs.has_changes == 'true'
197- id : create_pr
198- uses : peter-evans/create-pull-request@v6
199- with :
200- token : ${{ secrets.GITHUB_TOKEN }}
201- commit-message : " 🏆 Auto-update contributor statistics"
202- committer : " github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
203- author : " github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
204- branch : update-contributors-${{ github.run_number }}
205- delete-branch : true
206- title : " 🏆 Update Contributor Statistics"
207- body : |
208- ## 🏆 Automated Contributor Statistics Update
209-
210- This PR automatically updates:
211- - 👥 Contributors list in README.md
212- - 📊 Language statistics
213- - 📅 Last modified date in HALL_OF_FAME.md
214-
215- ### Changes
216- - Updated contributor avatars and information
217- - Refreshed language file counts
218- - Updated timestamp
219-
220- **Auto-generated by GitHub Actions** 🤖
221- ${{ github.event_name == 'pull_request' && format('**Triggered by PR #{0}** by @{1}', github.event.pull_request.number, github.event.pull_request.user.login) || '**Triggered by push to main**' }}
222- labels : |
223- documentation
224- automated
225- bot
226- assignees : ${{ github.repository_owner }}
227-
228- - name : 🔄 Enable Auto-Merge
229- if : steps.changes.outputs.has_changes == 'true' && steps.create_pr.outputs.pull-request-number != ''
230- env :
231- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
232197 run : |
233- PR_NUMBER="${{ steps.create_pr.outputs.pull-request-number }}"
234- echo "🔄 Attempting to enable auto-merge for PR #$PR_NUMBER..."
235-
236- # Try to enable auto-merge (will fail if not enabled in repo settings)
237- if gh pr merge $PR_NUMBER --auto --squash 2>/dev/null; then
238- echo "✅ Auto-merge enabled for PR #$PR_NUMBER"
198+ echo "⚙️ Configuring git..."
199+ git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
200+ git config --local user.name "github-actions[bot]"
201+
202+ echo "📦 Adding changed files..."
203+ git add README.md HALL_OF_FAME.md
204+
205+ echo "💬 Creating commit..."
206+ git commit -m "🏆 Auto-update contributor statistics [skip ci]"
207+
208+ echo "🚀 Pushing to main..."
209+ if git push origin main; then
210+ echo "✅ Successfully pushed to main!"
239211 else
240- echo "⚠️ Could not enable auto-merge. Please enable 'Allow auto-merge' in repository settings."
241- echo "📋 PR created: https://github.com/${{ github.repository }}/pull/$PR_NUMBER"
212+ echo "❌ Failed to push to main"
213+ echo ""
214+ echo "⚠️ If you're seeing branch protection errors, you need to:"
215+ echo "1. Create a Personal Access Token (PAT) with 'repo' scope"
216+ echo "2. Add it as a repository secret named 'PAT_TOKEN'"
217+ echo "3. The workflow will automatically use it to bypass branch protection"
218+ exit 1
242219 fi
243220
244- - name : 📋 Generate summary
221+ - name : 📋 Generate summary (with changes)
245222 if : steps.changes.outputs.has_changes == 'true'
246223 run : |
247224 echo "🏆 Contributors Update Summary"
248225 echo "=============================="
249226 echo ""
250- echo "📊 Action Taken: "
251- echo " ✅ Created PR with contributor updates "
252-
253- if [ -n "${{ steps.create_pr.outputs.pull-request-number }}" ]; then
254- echo " 🔗 PR #${{ steps.create_pr.outputs.pull-request-number }}"
255- echo " 📎 URL: ${{ steps.create_pr.outputs.pull-request-url }} "
227+ echo "✅ Successfully updated contributor statistics! "
228+ echo ""
229+ echo "📊 Updated files:"
230+ echo " - README.md (contributor list)"
231+ if [ -f "HALL_OF_FAME.md" ]; then
232+ echo " - HALL_OF_FAME.md (last modified date) "
256233 fi
257-
234+ echo ""
258235 if [ "${{ github.event_name }}" == "pull_request" ]; then
259- echo " 📅 Triggered by: PR #${{ github.event.pull_request.number }}"
260- echo " 👤 Contributor : @${{ github.event.pull_request.user.login }}"
236+ echo "📅 Triggered by: PR #${{ github.event.pull_request.number }}"
237+ echo "👤 New contributor : @${{ github.event.pull_request.user.login }}"
261238 else
262- echo " 📅 Triggered by: Push to main "
239+ echo "📅 Triggered by: ${{ github.event_name }} "
263240 fi
264241 echo ""
265- echo "🎉 Please review and merge the PR to apply contributor updates !"
242+ echo "🎉 Changes pushed directly to main branch !"
266243
267244 - name : 📋 Generate summary (no changes)
268245 if : steps.changes.outputs.has_changes == 'false'
269246 run : |
270247 echo "🏆 Contributors Update Summary"
271248 echo "=============================="
272249 echo ""
273- echo "ℹ️ No changes needed - contributors list is already up to date"
250+ echo "ℹ️ No changes needed - contributors list is already up to date"
0 commit comments