Skip to content

Address comments.

Address comments. #4

Workflow file for this run

name: Sync Commits to microsoft/copilot-eclipse
on:
# Trigger on push events to track force pushes
push:
branches-ignore:
- main
# Manual trigger with branch name
workflow_dispatch:
inputs:
branch_name:
description: 'Branch to sync'
required: true
type: string
jobs:
sync-commits:
runs-on: ubuntu-latest
permissions:
contents: write
env:
TARGET_REPO: microsoft/copilot-eclipse
BRANCH_NAME: ${{ github.event.inputs.branch_name || github.ref_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ github.ref }}
fetch-depth: 0
fetch-tags: true
- name: Configure git
run: |
git config user.email "actions@github.com"
git config user.name "Actions Auto Build"
header="$(echo -n x-access-token:${{ secrets.GH_COPILOT_ECLIPSE_ORIGIN }} | base64 | tr -d '\n')"
git config --local http.https://github.com/.extraheader "Authorization: basic $header"
git remote add target 'https://github.com/${{ env.TARGET_REPO }}.git'
- name: Sync commits
run: |
echo "Syncing commits to branch: ${{ env.BRANCH_NAME }}"
# Only use force push if the original push was forced
if [[ "${{ github.event_name }}" == "push" && "${{ github.event.forced }}" == "true" ]]; then
echo "Original push was forced, using force push"
git push --force target HEAD:${{ env.BRANCH_NAME }}
else
echo "Using normal push"
git push target HEAD:${{ env.BRANCH_NAME }}
fi