Home > Software engineering >  Why does `git rebase upstream/main` behaves differently when used GitHub actions compared to Local r
Why does `git rebase upstream/main` behaves differently when used GitHub actions compared to Local r

Time:01-21

git fetch upstream
git checkout main
git rebase upstream/main
git push -f origin main

These when run locally from cmd/bash, work flawlessly by updating my commits to the top of synced updates.
When I try to do the same with GitHub Actions just for sake of automation, why does it throw conflicts?

Auto-merging app/build.gradle
CONFLICT (add/add): Merge conflict in app/build.gradle
Auto-merging app/src/main/AndroidManifest.xml
CONFLICT (add/add): Merge conflict in app/src/main/AndroidManifest.xml
Auto-merging app/src/main/java/androidx/documentfile/provider/DocumentFileHelper.java
CONFLICT (add/add): Merge conflict in app/src/main/java/androidx/documentfile/provider/DocumentFileHelper.java
...
Auto-merging app/src/main/res/layout/about_preset_item.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/about_preset_item.xml
Auto-merging app/src/main/res/layout/conversation_list_fragment.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/conversation_list_fragment.xml
Auto-merging app/src/main/res/layout/dsl_payments_preference.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/dsl_payments_preference.xml
Auto-merging app/src/main/res/layout/edit_about_fragment.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/edit_about_fragment.xml
Auto-merging app/src/main/res/layout/edit_proxy_fragment.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/edit_proxy_fragment.xml
Auto-merging app/src/main/res/layout/fragment_edit_notification_profile.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/fragment_edit_notification_profile.xml
Auto-merging app/src/main/res/layout/main_activity_list_host_fragment.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/main_activity_list_host_fragment.xml
Auto-merging app/src/main/res/layout/manage_profile_fragment.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/manage_profile_fragment.xml
Auto-merging app/src/main/res/layout/my_support_preference.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/my_support_preference.xml
Auto-merging app/src/main/res/layout/on_reaction_sent_view.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/on_reaction_sent_view.xml
Auto-merging app/src/main/res/layout/share_button.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/share_button.xml
Auto-merging app/src/main/res/layout/signal_bottom_action_bar_item.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/signal_bottom_action_bar_item.xml
Auto-merging app/src/main/res/layout/signal_context_menu_item.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/signal_context_menu_item.xml
Auto-merging app/src/main/res/layout/sticker_management_sticker_item.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/sticker_management_sticker_item.xml
Auto-merging app/src/main/res/layout/stories_landing_item.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/stories_landing_item.xml
Auto-merging app/src/main/res/layout/stories_landing_item_my_stories.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/stories_landing_item_my_stories.xml
Auto-merging app/src/main/res/layout/stories_viewer_fragment_page.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/stories_viewer_fragment_page.xml
Auto-merging app/src/main/res/layout/tooltip.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/layout/tooltip.xml
Auto-merging app/src/main/res/navigation/sms_export.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/navigation/sms_export.xml
Auto-merging app/src/main/res/values-af/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-af/strings.xml
Auto-merging app/src/main/res/values-ar/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ar/strings.xml
Auto-merging app/src/main/res/values-az/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-az/strings.xml
Auto-merging app/src/main/res/values-bg/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-bg/strings.xml
Auto-merging app/src/main/res/values-bn/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-bn/strings.xml
Auto-merging app/src/main/res/values-bs/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-bs/strings.xml
Auto-merging app/src/main/res/values-ca/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ca/strings.xml
Auto-merging app/src/main/res/values-cs/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-cs/strings.xml
Auto-merging app/src/main/res/values-da/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-da/strings.xml
Auto-merging app/src/main/res/values-de/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-de/strings.xml
Auto-merging app/src/main/res/values-el/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-el/strings.xml
Auto-merging app/src/main/res/values-es/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-es/strings.xml
Auto-merging app/src/main/res/values-et/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-et/strings.xml
Auto-merging app/src/main/res/values-eu/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-eu/strings.xml
Auto-merging app/src/main/res/values-fa/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-fa/strings.xml
Auto-merging app/src/main/res/values-fi/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-fi/strings.xml
Auto-merging app/src/main/res/values-fr/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-fr/strings.xml
Auto-merging app/src/main/res/values-ga/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ga/strings.xml
Auto-merging app/src/main/res/values-gl/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-gl/strings.xml
Auto-merging app/src/main/res/values-gu/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-gu/strings.xml
Auto-merging app/src/main/res/values-hi/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-hi/strings.xml
Auto-merging app/src/main/res/values-hr/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-hr/strings.xml
Auto-merging app/src/main/res/values-hu/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-hu/strings.xml
Auto-merging app/src/main/res/values-in/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-in/strings.xml
Auto-merging app/src/main/res/values-it/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-it/strings.xml
Auto-merging app/src/main/res/values-iw/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-iw/strings.xml
Auto-merging app/src/main/res/values-ja/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ja/strings.xml
Auto-merging app/src/main/res/values-ka/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ka/strings.xml
Auto-merging app/src/main/res/values-kk/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-kk/strings.xml
Auto-merging app/src/main/res/values-km/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-km/strings.xml
Auto-merging app/src/main/res/values-kn/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-kn/strings.xml
Auto-merging app/src/main/res/values-ko/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ko/strings.xml
Auto-merging app/src/main/res/values-ky/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ky/strings.xml
Auto-merging app/src/main/res/values-lt/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-lt/strings.xml
Auto-merging app/src/main/res/values-lv/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-lv/strings.xml
Auto-merging app/src/main/res/values-mk/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-mk/strings.xml
Auto-merging app/src/main/res/values-ml/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ml/strings.xml
Auto-merging app/src/main/res/values-mr/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-mr/strings.xml
Auto-merging app/src/main/res/values-ms/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ms/strings.xml
Auto-merging app/src/main/res/values-my/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-my/strings.xml
Auto-merging app/src/main/res/values-nb/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-nb/strings.xml
Auto-merging app/src/main/res/values-nl/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-nl/strings.xml
Auto-merging app/src/main/res/values-pa/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-pa/strings.xml
Auto-merging app/src/main/res/values-pl/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-pl/strings.xml
Auto-merging app/src/main/res/values-pt-rBR/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-pt-rBR/strings.xml
Auto-merging app/src/main/res/values-pt/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-pt/strings.xml
Auto-merging app/src/main/res/values-ro/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ro/strings.xml
Auto-merging app/src/main/res/values-ru/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ru/strings.xml
Auto-merging app/src/main/res/values-sk/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-sk/strings.xml
Auto-merging app/src/main/res/values-sl/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-sl/strings.xml
Auto-merging app/src/main/res/values-sq/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-sq/strings.xml
Auto-merging app/src/main/res/values-sr/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-sr/strings.xml
Auto-merging app/src/main/res/values-sv/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-sv/strings.xml
Auto-merging app/src/main/res/values-sw/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-sw/strings.xml
Auto-merging app/src/main/res/values-ta/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ta/strings.xml
Auto-merging app/src/main/res/values-te/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-te/strings.xml
Auto-merging app/src/main/res/values-th/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-th/strings.xml
Auto-merging app/src/main/res/values-tl/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-tl/strings.xml
Auto-merging app/src/main/res/values-tr/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-tr/strings.xml
Auto-merging app/src/main/res/values-uk/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-uk/strings.xml
Auto-merging app/src/main/res/values-ur/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-ur/strings.xml
Auto-merging app/src/main/res/values-vi/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-vi/strings.xml
Auto-merging app/src/main/res/values-zh-rCN/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-zh-rCN/strings.xml
Auto-merging app/src/main/res/values-zh-rHK/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-zh-rHK/strings.xml
Auto-merging app/src/main/res/values-zh-rTW/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values-zh-rTW/strings.xml
Auto-merging app/src/main/res/values/ids.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values/ids.xml
Auto-merging app/src/main/res/values/strings.xml
CONFLICT (add/add): Merge conflict in app/src/main/res/values/strings.xml
...

Every changed file from upstream is shown as a conflict when trying to rebase ..

Where am I going wrong?

For context: I'm trying to run every line of update code under a single stream.

name: Update Fork

on:
  workflow_dispatch:
  push:
    branches: [ "main" ]
  # schedule:
  #   - cron: '0 10 * * *' # runs every everyday at 10:00

permissions:
  contents: write

jobs:
  update_fork:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Forked Repo
        uses: actions/checkout@v2
        with:
          repository: username/forked_repo
          ref: main

      - name: Setup Git
        run: git config --global user.email ${{ secrets.EMAIL }} && git config --global user.name user.name

      - name: Fetch from Upstream
        run: |
          git remote add upstream https://github.com/upstream/upstream.git
          git fetch upstream --tags
          git checkout main
          git rebase upstream/main
          git push -f origin main

Also, I thought this would solve my issue, but it seems to be not solving.

on running git rebase upstream/main || git diff, I'm getting differences which IMO shouldn't cause any issue just because it never caused as an issue in local repo.

  <<<<<<< HEAD
  def canonicalVersionCode = 1198
  def canonicalVersionName = "6.9.1.1"
  =======
  def canonicalVersionCode = 1196
  def canonicalVersionName = "6.8.3.0"
  >>>>>>> 54629fb86 (my_commit)

CodePudding user response:

Use fetch-depth: '0' with actions/checkout to fetch the complete history as you're rebasing.

The default is fetch-depth: '1'. See its Usage for more details.

Also, use @v3 of actions/checkout instead of @v2. The @v2 has deprecated NodeJS dependency.

  • Related