Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find pr during workflow triggered by push after rebase merge #112

Open
wickkidd opened this issue Apr 21, 2023 · 0 comments
Open

Find pr during workflow triggered by push after rebase merge #112

wickkidd opened this issue Apr 21, 2023 · 0 comments

Comments

@wickkidd
Copy link

This is what I found to work. It's not fool-proof as the same commit message could occur more than once and have been in more than one pr.

- name: Find PR
  id: find_pr
   env:
     GH_TOKEN: ${{ github.token }}
   run: |
     prs=$(gh pr list --search "${{ github.event.head_commit.message }}" --state merged)
     number=$(echo $prs | cut -d ' ' -f 1)
     echo "number=$number" >> $GITHUB_OUTPUT

It would be nice if this action could be made to accommodate this situation. If I get time, I'll take a look at the source to see if there's a sane way to add it.

Fun facts:

  • due to rebase, the commit sha has changed and the new one was never tied to a pr
  • the topic branch may already be deleted (as it is in my case)
  • searching the reflog you'd still end up having to use the message at some point afaict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant