automerge-action icon indicating copy to clipboard operation
automerge-action copied to clipboard

Missing commit if merge happens right after it

Open WillyJL opened this issue 2 years ago • 1 comments

I set up a workflow that runs when the repo owner approves a PR to:

  • do some last checks
  • update a config version number and commit it
  • merge the PR with this action
  • make a release from the base branch after the merge

It all goes perfectly, except that the merge happens right after the commit to the PR so this commit is not included when merging...

Commit was added fine in the PR: image

But not included in merge: image

This is a stripped version of my workflow:

on:
  pull_request_review:
    types: [submitted]

jobs:
  release:
    if: ... (check its the repo owner approving changes)
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: "Update version number"
        run: ...

      - name: "Commit new version number"
        uses: EndBug/add-and-commit@v9
        with:
          default_author: github_actions
          message: Update version number
          add: '...'

      - name: "Merge pull request"
        uses: "pascalgn/[email protected]"
        env:
          MERGE_LABELS: ""
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

      - name: "Make release"
        uses: softprops/action-gh-release@v1
        with:
          body_path: "..."
          draft: false
          prerelease: false
          files: ...
          name: "${{ env.RELEASE_TAG }}"
          tag_name: "${{ env.RELEASE_TAG }}"
          target_commitish: main

How could i fix this? Is there an option i can pass to the action to make sure the PR is updated? Or should i just add some hard-coded delay?

WillyJL avatar Mar 09 '23 20:03 WillyJL

I don't know about the other actions, but the configuration for automerge-action looks fine.

From my experience with GitHub, I am quite certain that something went wrong here that had nothing to do with either the automerge action or the GitHub API. My recommendation would be to investigate all involved steps closely, I believe the most probable cause is some kind of misconfiguration.

pascalgn avatar Apr 15 '23 13:04 pascalgn