gh-action-bump-version
gh-action-bump-version copied to clipboard
Couldn't find any commits in this event [...]
Having an issue of:
Couldn't find any commits in this event, incrementing patch version...
tagPrefix: v
tagSuffix:
commit messages: []
when trying to run an action on:
on:
pull_request:
types:
- closed
branches:
- main
jobs:
build:
if: github.event.pull_request.merged == true
[....]
Is there a reason it is not detecting the event / commit ?
Hi, do I understand this correctly: you want to run the action when you merge your PR? If so, whats your merge strategy? And does it generate a commit? (Merge, squash)
Hi @phips28,
Yes, that's exactly what I mean.
If so, whats your merge strategy?
Using squash merge, which is closed with a squash merge commit.
Hmm. There are no commit messages in your logs.
can you try push instead of pull_request action on your main branch?
Just for testing?
But other than that I cant really help here. Never had this setup you have.
i have the same problem when using this action with pull_request [opened], any chance to fix this (or introduce this functionality)?
Goal would be to bump the version when a PR to main is created.
current workflow:
name: Auto-bump version on PR
on:
pull_request:
types: [opened]
branches:
- main
jobs:
bump-version:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.AUTO_BUMP }}
- name: "Automated Version Bump"
uses: "phips28/gh-action-bump-version@master"
env:
GITHUB_USER: "xxx"
GITHUB_EMAIL: "xxx"
GITHUB_TOKEN: ${{ secrets.AUTO_BUMP }}
with:
default: patch
skip-tag: "true"
commit-message: 'CI: bump version to {{version}} [skip ci]'
minor-wording: "#minor"
major-wording: "#major"
patch-wording: "#patch"
I am happy if you provide a PR for that functionality🙂 Currently I am too busy to work on that feature
Hi all, just a quick comment as I have come across the same issue. The action will only work for the push trigger as the code is looking for the commits property on the GITHUB_EVENT_PATH env which contains the payload for the event that triggered the workflow.
If you look at the PR payload https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request the commits property doesn't exists and therefore that's why the action can't find any commits.
I think the best way to improve this is to check the event type and if its not a push then make an api call to get the commits for the triggering branch. This could theoretically work for all other event types too.
Thanks @darryl-alcumus ! this is really helped! I was suffered with same issue. my version plan is "bump the version when PR to main is closed" but never triggered with version wording.
Now I changed events from pull_request to push. anyway, push event also happens after PR was closed and merged.