Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline/backtrack [ignore, just some random testing] #563

Closed
wants to merge 23 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fetch target branch
Splines committed Nov 14, 2023
commit 573a0ace7148e9df13d1587c6ceeaf84df14d5c1
14 changes: 11 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -16,23 +16,31 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 2 # to also fetch parent commit for git diff

- name: Set up Ruby 3
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.4
bundler-cache: true

# If this action is not triggered from a PR, we use 'mampf-next' as default
# target branch to compare against. This might not cover all use cases.
# But in the end, one has to open a PR anyways and then the correct target
# branch is identified.
# TODO: rename to 'dev' when 'mampf-next' branch is renamed.
- name: Fetch target branch
run: |
targetBranch=${{ github.base_ref || 'mampf-next' }}
echo "Target branch is: $targetBranch"
git fetch origin $targetBranch:$targetBranch --depth=1

# adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
# and: https://robertfaldo.medium.com/commands-to-run-rubocop-and-specs-you-changed-in-your-branch-e6d2f2e4110b
# --diff-filter=d excludes deleted files
# "|| test $? = 1;" is used to ignore the exit code of grep when no files
# are found matching the pattern
- name: Get changed ruby files (git diff)
run: |
targetBranch=${{ github.base_ref || 'mampf-next' }}
changedFiles=$(git diff --name-only --diff-filter=d -r $targetBranch | grep '\.rb$' || test $? = 1;)
printf "Changed ruby files: \n$changedFiles"
echo "CHANGED_FILES=\"$changedFiles\"" >> $GITHUB_ENV