Skip to content

Print Changed Files

Print Changed Files #8

Workflow file for this run

name: Version Check
on:
workflow_dispatch
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get default branch
run: |
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
echo "Default branch is: $DEFAULT_BRANCH"
- name: Check version increment
run: |
# Get the base commit SHA (where the branch started)
BASE_SHA=$(git merge-base $DEFAULT_BRANCH HEAD)
# Check if 'config.yml' was modified in this pull request
if git diff --name-only $BASE_SHA HEAD | grep -q 'config.yml'; then
# Check if the version was incremented
if git diff $BASE_SHA HEAD 'config.yml' | grep -E '^\+[[:space:]]+version:[[:space:]]+[0-9]+\.[0-9]+\.[0-9]+'; then
echo "Version incremented. Check passed."
else
echo "Error: Version in 'config.yml' was not incremented. Please update the version before merging."
exit 1
fi
else
echo "config.yml not modified. Skipping version check."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}