Skip to content

Changeset Version Bump #3

Changeset Version Bump

Changeset Version Bump #3

name: "Tag on Pull Request merge"
on:
# Should trigger only when a Pull Request is Closed
# (the action will not create the Tag if the Pull Request is discarded - closed without merge)
pull_request:
types:
- closed
branches:
- main
- test_workflow_branch
jobs:
TagOnPR:
name: Tag on Pull Request merge
runs-on: ubuntu-latest
# This 'if' condition is important for ensuring the workflow only runs for merged PRs
# (avoid running when a PR is discarded - closed without merging)
if: |

Check failure on line 18 in .github/workflows/tag-release-on-pr-merged.yml

View workflow run for this annotation

GitHub Actions / Tag on Pull Request merge

Invalid workflow file

The workflow is not valid. .github/workflows/tag-release-on-pr-merged.yml (Line: 18, Col: 9): Unrecognized named-value: 'steps'. Located at position 106 within expression: contains(github.event.pull_request.title, 'Version Bump') && github.event.pull_request.merged == true && steps.check_version.outputs.validVersion == 'true'
contains(github.event.pull_request.title, 'Version Bump') &&
github.event.pull_request.merged == true &&
steps.check_version.outputs.validVersion == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check Version
id: check_version
run: |
version=$(echo "$GITHUB_EVENT_PULL_REQUEST_TITLE" | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+')
if [[ -n "$version" ]]; then
echo "::set-output name=validVersion::true"
echo "::set-output name=version::$version"
else
echo "::set-output name=validVersion::false"
- name: Tag Version
if: ${{ steps.check_version.outputs.validVersion == 'true' }}
run: |
git tag -a ${{ steps.check_version.outputs.version }} -m "Tagging version ${{ steps.check_version.outputs.version }}"
git push origin ${{ steps.check_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print fetched version
run: echo "${{ steps.check_version.outputs.version }}"