@@ -207,15 +207,81 @@ jobs:
207207
208208 - name : 💾 Commit Changes
209209 run : |
210- ./scripts/prepare-commit.sh "${ISSUE_NUMBER}" "${ISSUE_TITLE}" "${ISSUE_CREATOR}"
210+ echo "📝 Preparing commit..."
211+
212+ # Co-author info from issue creator
213+ CREATOR_NAME="${ISSUE_CREATOR}"
214+ CREATOR_EMAIL="${ISSUE_CREATOR}@users.noreply.github.com"
215+ echo "👤 Co-author: ${CREATOR_NAME} <${CREATOR_EMAIL}>"
216+
217+ # Add all files except metadata files
218+ git add .
219+
220+ # Exclude metadata files from commit
221+ for file in copilot-summary.md commit-message.md .final-commit-msg.txt .github/copilot-instructions.md; do
222+ if git ls-files --cached "$file" > /dev/null 2>&1; then
223+ git reset HEAD "$file" 2>/dev/null || true
224+ fi
225+ done
226+
227+ # Check if there are any staged changes
228+ if ! git diff --cached --quiet; then
229+ echo "✅ Changes staged for commit"
230+ else
231+ echo "⚠️ No changes staged for commit"
232+ fi
233+
234+ # Prepare final commit message with co-author
235+ if [ -f "commit-message.md" ]; then
236+ echo "✅ Using Copilot-generated commit message"
237+ {
238+ cat commit-message.md
239+ echo ""
240+ echo ""
241+ echo "Co-authored-by: ${CREATOR_NAME} <${CREATOR_EMAIL}>"
242+ } > .final-commit-msg.txt
243+ else
244+ echo "⚠️ commit-message.md not found, using default message"
245+ {
246+ echo "feat: Implement issue ${ISSUE_NUMBER}"
247+ echo ""
248+ echo "${ISSUE_TITLE}"
249+ echo ""
250+ echo "Changes implemented by GitHub Copilot CLI"
251+ echo ""
252+ echo "Co-authored-by: ${CREATOR_NAME} <${CREATOR_EMAIL}>"
253+ } > .final-commit-msg.txt
254+ fi
255+
256+ # Create commit if there are staged changes
257+ if git diff --cached --quiet; then
258+ echo "⚠️ No staged changes to commit, skipping git commit"
259+ else
260+ git commit -F .final-commit-msg.txt
261+ echo "✅ Changes committed successfully"
262+ fi
263+
264+ # Clean up
265+ rm -f .final-commit-msg.txt
211266 env :
212267 ISSUE_NUMBER : ${{ github.event.issue.number }}
213268 ISSUE_TITLE : ${{ github.event.issue.title }}
214269 ISSUE_CREATOR : ${{ github.event.issue.user.login }}
215270
216271 - name : 🚀 Push Branch
217272 run : |
218- ./scripts/push-branch.sh "${{ env.BRANCH_NAME }}"
273+ echo "🚀 Pushing branch to remote..."
274+
275+ # Configure git remote with GH_TOKEN for authentication
276+ REMOTE_URL=$(git remote get-url origin)
277+ if [[ "$REMOTE_URL" == https://* ]]; then
278+ REPO_PATH=$(echo "$REMOTE_URL" | sed 's|https://[^/]*/||')
279+ GITHUB_HOST=$(echo "$REMOTE_URL" | sed 's|https://||' | sed 's|/.*||')
280+ git remote set-url origin "https://x-access-token:${GH_TOKEN}@${GITHUB_HOST}/${REPO_PATH}"
281+ fi
282+
283+ git push -u origin "${{ env.BRANCH_NAME }}"
284+ echo "✅ Branch pushed successfully"
219285 env :
220286 GH_TOKEN : ${{ secrets.GH_TOKEN }}
221287
@@ -263,7 +329,29 @@ jobs:
263329
264330 - name : 💬 Add Completion Comment to Issue
265331 run : |
266- ./scripts/post-workflow-comment.sh "${ISSUE_NUMBER}" "${PR_URL}"
332+ echo "💬 Adding completion comment to issue #${ISSUE_NUMBER}..."
333+
334+ COMMENT="## 🎉 Implementation Complete!
335+
336+ The GitHub Copilot CLI has successfully implemented the changes for this issue.
337+
338+ ### 📬 Pull Request
339+ A Pull Request has been created with the implementation:
340+ ${PR_URL}
341+
342+ ### 👀 Next Steps
343+ 1. Review the Pull Request
344+ 2. Test the implementation
345+ 3. Approve and merge if everything looks good
346+
347+ ### 📦 Logs
348+ Workflow logs and Copilot execution logs are available in the workflow run artifacts.
349+
350+ ---
351+ *This comment was automatically generated by the GitHub Copilot Coder workflow.*"
352+
353+ gh issue comment "${ISSUE_NUMBER}" --body "${COMMENT}"
354+ echo "✅ Comment added successfully"
267355 env :
268356 GH_TOKEN : ${{ secrets.GH_TOKEN }}
269357 ISSUE_NUMBER : ${{ github.event.issue.number }}
0 commit comments