question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deleting Files in Follower Branch

See original GitHub issue

Deleting Files in Follower Branch

We have been using this action to keep main in sync with staging branch each night. This is working great for new and modified files.

Recently, we noticed that files deleted in the main branch are not deleted in the staging branch.

How can we ensure that files deleted in main are also deleted in staging?

Steps to reproduce

We are using the action as follows:

name: sync-changes-on-main-to-staging
on: [workflow_dispatch]

jobs:
  sync-changes-on-main-to-staging:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          ref: staging

      - name: Set Git Configs
        run: |
          git config user.name "GitHub Actions Bot"
          git config user.email "<>"
          git fetch origin main:main
          git merge main -X theirs --allow-unrelated-histories

      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v4
        with:
          title: "Merge main to staging"
          branch: staging-promotion
          delete-branch: true
          token: ${{ secrets.PAT }}

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
skeep-exogeecommented, Dec 21, 2022

Thanks @peter-evans for your help this is working:

     - name: Reset promotion branch
        run: |
          git config user.name "GitHub Actions Bot"
          git config user.email "<>"
          git config pull.rebase true
          git fetch origin main:main
          git reset --hard main
          git pull -X theirs
0reactions
skeep-exogeecommented, Dec 21, 2022

hmmm I get a different output on the github action

Run git config user.name "GitHub Actions Bot"
  git config user.name "GitHub Actions Bot"
  git config user.email "<>"
  git fetch origin main:main
  git merge main -X theirs --allow-unrelated-histories
  git status
  shell: /usr/bin/bash -e {0}
From https://github.com/skeep-exogee/test-actions
 * [new branch]      main       -> main
 * [new branch]      main       -> origin/main
Merge made by the 'ort' strategy.
On branch staging
Your branch is ahead of 'origin/staging' by [4](https://github.com/skeep-exogee/test-actions/actions/runs/3746192452/jobs/6361313598#step:3:4)4 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove an updated file from a PR on GitHub - ffeathers
The instructions below assume that the unwanted updates are in a file that already exists in the GitHub repository. If the unwanted updates...
Read more >
How do I delete a file from a Git repository?
Simply view any file in your repository, click the trash can icon at the top, and commit the removal just like any other...
Read more >
Solved: How to delete a file at remote branch after I dele...
It will stage the deleted file, and followed by git commit and git push will remove the file from the repository. 2) (use...
Read more >
Add or Remove Followers to a Record with the Help of ...
In Salesforce, a user can follow Chatter groups or Records. ... Add a Delete Records element to remove a follower from the account....
Read more >
Deleting files in a repository
Browse to the directory in your repository that you want to delete. · In the top-right corner, click , then click Delete directory....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found