diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index aacec3e..c6bb607 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -21,11 +21,30 @@ jobs: - name: Setup Git run: | - git config user.name "Nicolas Thumann" - git config user.email "me@n-thumann.de" + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - name: Bump version - run: npm version ${{ github.event.inputs.version }} + run: > + echo "BUMPED_VERSION=$( + npm version --commit-hooks false --git-tag-version false patch + )" | tee -a $GITHUB_ENV - - name: Push latest version - run: git push origin main --follow-tags \ No newline at end of file + - name: Checkout and push branch + run: | + git checkout -b bump_version_${{ env.BUMPED_VERSION }} + git push origin bump_version_${{ env.BUMPED_VERSION }} + + - name: Create PR + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.pulls.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: "Bump version to ${{ env.BUMPED_VERSION }}" + head: bump_version_${{ env.BUMPED_VERSION }}, + base: "main", + body: "This PR bumps the version to ${{ env.bumped_tag }}, as requested by @${{ github.actor }} in https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}." + }) \ No newline at end of file