diff --git a/.github/workflows/gem-bump-checker.yml b/.github/workflows/gem-bump-checker.yml index b5703fa77..7448fa238 100644 --- a/.github/workflows/gem-bump-checker.yml +++ b/.github/workflows/gem-bump-checker.yml @@ -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: @@ -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."