Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
MuriloDalRi committed Jul 4, 2024
1 parent 093c8cf commit 123ebe3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/gem-bump-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
secrets:
GH_TOKEN:
required: true
inputs:
ignored_files:
description: 'JSON string of files or directories to be ignored'
required: false
type: string

jobs:
check-files:
Expand All @@ -21,11 +26,19 @@ jobs:
- name: Check for version and changelog updates
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
IGNORED_FILES_JSON: ${{ inputs.ignored_files }}
run: |
BASE_REF=$(git ls-remote origin HEAD | cut -f 1)
HEAD_REF=$(git rev-parse HEAD)
MODIFIED_FILES=$(git diff --name-only "$BASE_REF".."$HEAD_REF")
if [ -n "$IGNORED_FILES_JSON" ]; then
IGNORED_FILES=$(echo "$IGNORED_FILES_JSON" | tr -d '[]' | tr ',' '\n' | tr -d '"')
for file in $IGNORED_FILES; do
MODIFIED_FILES=$(echo "$MODIFIED_FILES" | grep -v "$file")
done
fi
if ! echo "$MODIFIED_FILES" | grep 'version.rb' && \
! echo "$MODIFIED_FILES" | grep '\.gemspec$'; then
echo "Error: Either version.rb or a .gemspec file must be modified with each pull request to bump the gem version."
Expand Down

0 comments on commit 123ebe3

Please sign in to comment.