Skip to content

Unmerged commits older than the workflow's are getting deleted by create-pull-request #3808

@oleole39

Description

@oleole39

Hello,

Thanks for creating this action!

I am having a workflow which basically consists in building an asset, creating a draft release and making a change in the file manifest.toml, before creating a commit for that change and open a PR from branch testing to master. The whole workflow is meant to run on branch testing.

Prior to running the workflow, testing may or may not have existing commits waiting to be merged to master, but my current issue happens in the case it has such commits.

Once the workflow has run, the PR with the commit to manifest.toml is created BUT all previous commits (not yet merged to master) are gone. Instead I would have expected the PR to include all yet unmerged commits AND the commit to manifest.toml so that I find one PR with ALL commits waiting to be merged to master.

Is that a bug, or is there an option I would have missed, or is that somehow meant that way ?

I am 100% sure that the deletion of commits happens during execution of create-pull-request because I have tested other parts of the workflow independently without noticing such issue.

Related sections of the workflow
      - name: Replace URL & SHA256 in manifest.toml
        run: |
          sed -i '/\[resources.sources.ynh_build\]/,/sha256/ {
              /url/s|=.*$|= "${{ steps.build_release.outputs.YNH_RELEASE_URL }}"|
              /sha256/s|=.*$|= "${{ steps.build_release.outputs.YNH_RELEASE_SHA }}"|
          }' manifest.toml

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v7
        with:
          add-paths: manifest.toml
          commit-message: 'Update release in manifest'
          base: master
          branch: testing
          title: 'Update to ${{ steps.build_release.outputs.YNH_RELEASE_VERSION }}'
          body: |
            Upstream upgrade is now built for YNH and ready to be released in the current repository: ${{ steps.draft_release.outputs.url }}
            - [ ] Make sure the release is published before testing this PR.
            - [ ] Rename PR title with appropriate version number.
Related sections of the action log
Run peter-evans/create-pull-request@v7
Prepare git configuration
Determining the base and head repositories
Pull request branch target repository set to YunoHost-Apps/jsoncrack_ynh
Configuring credential for HTTPS authentication
Checking the base repository state
Pull request branch to create or update set to 'testing'
Configuring the committer and author
Create or update the pull request branch
  /usr/bin/git symbolic-ref HEAD --short
  testing
  Working base is branch 'testing'
  /usr/bin/git checkout --progress -B 9cee6acc-d385-4c09-b973-a942d177543e HEAD --
  Switched to a new branch '9cee6acc-d385-4c09-b973-a942d177543e'
  M	manifest.toml
  M	scripts/build
  /usr/bin/git status --porcelain -unormal -- manifest.toml
   M manifest.toml
  Uncommitted changes found. Adding a commit.
  /usr/bin/git add -- manifest.toml
  /usr/bin/git -c author.name=oleole39 -c author.email=MY_EMAIL -c committer.name=github-actions[bot] -c committer.email=41898282+github-actions[bot]@users.noreply.github.com commit -m Update release in manifest
  [9cee6acc-d385-4c09-b973-a942d177543e caae313] Update release in manifest
   Author: oleole39 <MY_EMAIL>
   1 file changed, 1 insertion(+), 1 deletion(-)
  /usr/bin/git stash push --include-untracked
  Saved working directory and index state WIP on 9cee6acc-d385-4c09-b973-a942d177543e: caae313 Update release in manifest
  Resetting working base branch 'testing'
  /usr/bin/git checkout --progress testing --
  Switched to branch 'testing'
  Your branch is up to date with 'origin/testing'.
  /usr/bin/git reset --hard origin/testing
  HEAD is now at 988aca0 workflows - remove double commit action
  Rebasing commits made to branch 'testing' on to base branch 'master'
  /usr/bin/git -c protocol.version=2 fetch --no-tags --progress --no-recurse-submodules --force --depth=1 origin master:master
  remote: Enumerating objects: 19, done.        
  remote: Counting objects:   5% (1/19)        
  remote: Counting objects:  10% (2/19)        
  remote: Counting objects:  15% (3/19)        
  remote: Counting objects:  21% (4/19)        
  remote: Counting objects:  26% (5/19)        
  remote: Counting objects:  31% (6/19)        
  remote: Counting objects:  36% (7/19)        
  remote: Counting objects:  42% (8/19)        
  remote: Counting objects:  47% (9/19)        
  remote: Counting objects:  52% (10/19)        
  remote: Counting objects:  57% (11/19)        
  remote: Counting objects:  63% (12/19)        
  remote: Counting objects:  68% (13/19)        
  remote: Counting objects:  73% (14/19)        
  remote: Counting objects:  78% (15/19)        
  remote: Counting objects:  84% (16/19)        
  remote: Counting objects:  89% (17/19)        
  remote: Counting objects:  94% (18/19)        
  remote: Counting objects: 100% (19/19)        
  remote: Counting objects: 100% (19/19), done.        
  remote: Compressing objects:  10% (1/10)        
  remote: Compressing objects:  20% (2/10)        
  remote: Compressing objects:  30% (3/10)        
  remote: Compressing objects:  40% (4/10)        
  remote: Compressing objects:  50% (5/10)        
  remote: Compressing objects:  60% (6/10)        
  remote: Compressing objects:  70% (7/10)        
  remote: Compressing objects:  80% (8/10)        
  remote: Compressing objects:  90% (9/10)        
  remote: Compressing objects: 100% (10/10)        
  remote: Compressing objects: 100% (10/10), done.        
  remote: Total 10 (delta 8), reused 0 (delta 0), pack-reused 0 (from 0)        
  From https://github.com/YunoHost-Apps/jsoncrack_ynh
   * [new branch]      master     -> master
   * [new branch]      master     -> origin/master
  /usr/bin/git checkout --progress master --
  Switched to branch 'master'
  /usr/bin/git rev-list --reverse testing..9cee6acc-d385-4c09-b973-a942d177543e .
  caae313691d51aedcced03aa7a91c958445e9550
  /usr/bin/git -c author.name=oleole39 -c author.email=MY_EMAIL -c committer.name=github-actions[bot] -c committer.email=41898282+github-actions[bot]@users.noreply.github.com cherry-pick --strategy=recursive --strategy-option=theirs caae313691d51aedcced03aa7a91c958445e9550
  Auto-merging manifest.toml
  [master 721c034] Update release in manifest
   Author: oleole39 <MY_EMAIL>
   Date: Thu Mar 13 13:47:03 2025 +0000
   1 file changed, 2 insertions(+), 2 deletions(-)
  /usr/bin/git checkout --progress -B 9cee6acc-d385-4c09-b973-a942d177543e HEAD --
  Switched to and reset branch '9cee6acc-d385-4c09-b973-a942d177543e'
  /usr/bin/git -c protocol.version=2 fetch --no-tags --progress --no-recurse-submodules --force --depth=1 origin master:master
  remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)        
  From https://github.com/YunoHost-Apps/jsoncrack_ynh
   + 721c034...ff86efb master     -> master  (forced update)
  /usr/bin/git rev-list --right-only --count master...9cee6acc-d385-4c09-b973-a942d177543e
  1
  /usr/bin/git -c protocol.version=2 fetch --no-tags --progress --no-recurse-submodules --force --depth=11 origin testing:refs/remotes/origin/testing
  remote: Enumerating objects: 115, done.        
  remote: Counting objects:   0% (1/105)        
  remote: Counting objects:   1% (2/105)        
  remote: Counting objects:   2% (3/105)        
  remote: Counting objects:   3% (4/105)        
  remote: Counting objects:   4% (5/105)        
  remote: Counting objects:   5% (6/105)        
  remote: Counting objects:   6% (7/105)        
  remote: Counting objects:   7% (8/105)        
  remote: Counting objects:   8% (9/105)        
  remote: Counting objects:   9% (10/105)        
  remote: Counting objects:  10% (11/105)        
  remote: Counting objects:  11% (12/105)        
  remote: Counting objects:  12% (13/105)        
  remote: Counting objects:  13% (14/105)        
  remote: Counting objects:  14% (15/105)        
  remote: Counting objects:  15% (16/105)        
  remote: Counting objects:  16% (17/105)        
  remote: Counting objects:  17% (18/105)        
  remote: Counting objects:  18% (19/105)        
  remote: Counting objects:  19% (20/105)        
  remote: Counting objects:  20% (21/105)        
  remote: Counting objects:  21% (23/105)        
  remote: Counting objects:  22% (24/105)        
  remote: Counting objects:  23% (25/105)        
  remote: Counting objects:  24% (26/105)        
  remote: Counting objects:  25% (27/105)        
  remote: Counting objects:  26% (28/105)        
  remote: Counting objects:  27% (29/105)        
  remote: Counting objects:  28% (30/105)        
  remote: Counting objects:  29% (31/105)        
  remote: Counting objects:  30% (32/105)        
  remote: Counting objects:  31% (33/105)        
  remote: Counting objects:  32% (34/105)        
  remote: Counting objects:  33% (35/105)        
  remote: Counting objects:  34% (36/105)        
  remote: Counting objects:  35% (37/105)        
  remote: Counting objects:  36% (38/105)        
  remote: Counting objects:  37% (39/105)        
  remote: Counting objects:  38% (40/105)        
  remote: Counting objects:  39% (41/105)        
  remote: Counting objects:  40% (42/105)        
  remote: Counting objects:  41% (44/105)        
  remote: Counting objects:  42% (45/105)        
  remote: Counting objects:  43% (46/105)        
  remote: Counting objects:  44% (47/105)        
  remote: Counting objects:  45% (48/105)        
  remote: Counting objects:  46% (49/105)        
  remote: Counting objects:  47% (50/105)        
  remote: Counting objects:  48% (51/105)        
  remote: Counting objects:  49% (52/105)        
  remote: Counting objects:  50% (53/105)        
  remote: Counting objects:  51% (54/105)        
  remote: Counting objects:  52% (55/105)        
  remote: Counting objects:  53% (56/105)        
  remote: Counting objects:  54% (57/105)        
  remote: Counting objects:  55% (58/105)        
  remote: Counting objects:  56% (59/105)        
  remote: Counting objects:  57% (60/105)        
  remote: Counting objects:  58% (61/105)        
  remote: Counting objects:  59% (62/105)        
  remote: Counting objects:  60% (63/105)        
  remote: Counting objects:  61% (65/105)        
  remote: Counting objects:  62% (66/105)        
  remote: Counting objects:  63% (67/105)        
  remote: Counting objects:  64% (68/105)        
  remote: Counting objects:  65% (69/105)        
  remote: Counting objects:  66% (70/105)        
  remote: Counting objects:  67% (71/105)        
  remote: Counting objects:  68% (72/105)        
  remote: Counting objects:  69% (73/105)        
  remote: Counting objects:  70% (74/105)        
  remote: Counting objects:  71% (75/105)        
  remote: Counting objects:  72% (76/105)        
  remote: Counting objects:  73% (77/105)        
  remote: Counting objects:  74% (78/105)        
  remote: Counting objects:  75% (79/105)        
  remote: Counting objects:  76% (80/105)        
  remote: Counting objects:  77% (81/105)        
  remote: Counting objects:  78% (82/105)        
  remote: Counting objects:  79% (83/105)        
  remote: Counting objects:  80% (84/105)        
  remote: Counting objects:  81% (86/105)        
  remote: Counting objects:  82% (87/105)        
  remote: Counting objects:  83% (88/105)        
  remote: Counting objects:  84% (89/105)        
  remote: Counting objects:  85% (90/105)        
  remote: Counting objects:  86% (91/105)        
  remote: Counting objects:  87% (92/105)        
  remote: Counting objects:  88% (93/105)        
  remote: Counting objects:  89% (94/105)        
  remote: Counting objects:  90% (95/105)        
  remote: Counting objects:  91% (96/105)        
  remote: Counting objects:  92% (97/105)        
  remote: Counting objects:  93% (98/105)        
  remote: Counting objects:  94% (99/105)        
  remote: Counting objects:  95% (100/105)        
  remote: Counting objects:  96% (101/105)        
  remote: Counting objects:  97% (102/105)        
  remote: Counting objects:  98% (103/105)        
  remote: Counting objects:  99% (104/105)        
  remote: Counting objects: 100% (105/105)        
  remote: Counting objects: 100% (105/105), done.        
  remote: Compressing objects:   2% (1/45)        
  remote: Compressing objects:   4% (2/45)        
  remote: Compressing objects:   6% (3/45)        
  remote: Compressing objects:   8% (4/45)        
  remote: Compressing objects:  11% (5/45)        
  remote: Compressing objects:  13% (6/45)        
  remote: Compressing objects:  15% (7/45)        
  remote: Compressing objects:  17% (8/45)        
  remote: Compressing objects:  20% (9/45)        
  remote: Compressing objects:  22% (10/45)        
  remote: Compressing objects:  24% (11/45)        
  remote: Compressing objects:  26% (12/45)        
  remote: Compressing objects:  28% (13/45)        
  remote: Compressing objects:  31% (14/45)        
  remote: Compressing objects:  33% (15/45)        
  remote: Compressing objects:  35% (16/45)        
  remote: Compressing objects:  37% (17/45)        
  remote: Compressing objects:  40% (18/45)        
  remote: Compressing objects:  42% (19/45)        
  remote: Compressing objects:  44% (20/45)        
  remote: Compressing objects:  46% (21/45)        
  remote: Compressing objects:  48% (22/45)        
  remote: Compressing objects:  51% (23/45)        
  remote: Compressing objects:  53% (24/45)        
  remote: Compressing objects:  55% (25/45)        
  remote: Compressing objects:  57% (26/45)        
  remote: Compressing objects:  60% (27/45)        
  remote: Compressing objects:  62% (28/45)        
  remote: Compressing objects:  64% (29/45)        
  remote: Compressing objects:  66% (30/45)        
  remote: Compressing objects:  68% (31/45)        
  remote: Compressing objects:  71% (32/45)        
  remote: Compressing objects:  73% (33/45)        
  remote: Compressing objects:  75% (34/45)        
  remote: Compressing objects:  77% (35/45)        
  remote: Compressing objects:  80% (36/45)        
  remote: Compressing objects:  82% (37/45)        
  remote: Compressing objects:  84% (38/45)        
  remote: Compressing objects:  86% (39/45)        
  remote: Compressing objects:  88% (40/45)        
  remote: Compressing objects:  91% (41/45)        
  remote: Compressing objects:  93% (42/45)        
  remote: Compressing objects:  95% (43/45)        
  remote: Compressing objects:  97% (44/45)        
  remote: Compressing objects: 100% (45/45)        
  remote: Compressing objects: 100% (45/45), done.        
  remote: Total 77 (delta 60), reused 45 (delta 32), pack-reused 0 (from 0)        
  Pull request branch 'testing' already exists as remote branch 'origin/testing'
  /usr/bin/git checkout --progress testing --
  Switched to branch 'testing'
  Your branch is up to date with 'origin/testing'.
  /usr/bin/git rev-list --right-only --count master...testing
  5
  /usr/bin/git diff --quiet testing..9cee6acc-d385-4c09-b973-a942d177543e
  Resetting 'testing'
  /usr/bin/git checkout --progress -B testing 9cee6acc-d385-4c09-b973-a942d177543e --
  Reset branch 'testing'
  Your branch and 'origin/testing' have diverged,
  and have 1 and 5 different commits each, respectively.
    (use "git pull" if you want to integrate the remote branch with yours)
  /usr/bin/git rev-list --right-only --count origin/testing...testing
  1
  Updated branch 'testing'
  /usr/bin/git rev-list --right-only --count master...testing
  1
  /usr/bin/git rev-parse master
  ff86efb30daea95e17df26ac820387000fd6b7bc
  /usr/bin/git -c core.quotePath=false show --raw --cc --no-renames --no-abbrev --format=%H%n%T%n%P%n%G?%n%s%n%b%n###EOB### ff86efb30daea95e17df26ac820387000fd6b7bc
  /usr/bin/git rev-parse testing
  721c03497d08c13a697440fe3a8c6961d95a67ce
  /usr/bin/git log --format=%H master..testing
  721c03497d08c13a697440fe3a8c6961d95a67ce
  /usr/bin/git -c core.quotePath=false show --raw --cc --no-renames --no-abbrev --format=%H%n%T%n%P%n%G?%n%s%n%b%n###EOB### 721c03497d08c13a697440fe3a8c6961d95a67ce
  /usr/bin/git branch --delete --force 9cee6acc-d385-4c09-b973-a942d177543e
  Deleted branch 9cee6acc-d385-4c09-b973-a942d177543e (was 721c034).
  /usr/bin/git checkout --progress testing --
  Already on 'testing'
  Your branch and 'origin/testing' have diverged,
  and have 1 and 5 different commits each, respectively.
    (use "git pull" if you want to integrate the remote branch with yours)
  /usr/bin/git stash pop
  On branch testing
  Your branch and 'origin/testing' have diverged,
  and have 1 and 5 different commits each, respectively.
    (use "git pull" if you want to integrate the remote branch with yours)
  
  Changes not staged for commit:
    (use "git add <file>..." to update what will be committed)
    (use "git restore <file>..." to discard changes in working directory)
  	modified:   scripts/build
  
  Untracked files:
    (use "git add <file>..." to include in what will be committed)
  	jsoncrack.com_v2025.03.11_ff0b435b_ynh.zip
  
  no changes added to commit (use "git add" and/or "git commit -a")
  Dropped refs/stash@{0} (04a95341fdb382d7e46ac6639cb278c8a6969124)
Pushing pull request branch to 'origin/testing'
  /usr/bin/git push --force-with-lease origin testing:refs/heads/testing
  To https://github.com/YunoHost-Apps/jsoncrack_ynh
   + 988aca0...721c034 testing -> testing (forced update)
Create or update the pull request
Setting outputs
Restore git configuration

EDIT: hmm I get from the log that it actually tries to create a new testing branch from scratch ?
Maybe I would need an option to git pull at that point ?

  Your branch and 'origin/testing' have diverged,
  and have 1 and 5 different commits each, respectively.
    (use "git pull" if you want to integrate the remote branch with yours)

The branch with 5 commits is my original testing branch before running the workflow. The one with 1 commit is the one that seems to be created by create-pull-request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions