Skip to content

Commit

Permalink
Update get crate logic based on commit history
Browse files Browse the repository at this point in the history
  • Loading branch information
Shourya742 committed Jul 12, 2024
1 parent 1418a26 commit d374f02
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/semver-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- "main"
- "dev"
pull_request:
branches:
- "main"
- "dev"

jobs:
semver-check:
Expand Down Expand Up @@ -101,10 +103,18 @@ jobs:
- name: Install cargo-semver-checks
run: cargo install cargo-semver-checks --locked

- name: Fetch all branches
run: git fetch --all

- name: Identify target branch
id: target_branch
run: echo "::set-output name=branch::$(git rev-parse --abbrev-ref --symbolic-full-name @{u} | cut -d'/' -f2)"

- name: Identify changed crates
id: changes
run: |
echo "::set-output name=changed_crates::$(git diff --name-only HEAD^ HEAD | grep '^crates/' | cut -d'/' -f2 | sort | uniq)"
TARGET_BRANCH=$(echo "${{ steps.target_branch.outputs.branch }}")
echo "::set-output name=changed_crates::$(git diff --name-only origin/$TARGET_BRANCH...HEAD | grep '^crates/' | cut -d'/' -f2 | sort | uniq)"
- name: Run semver checks
if: steps.changes.outputs.changed_crates
Expand Down

0 comments on commit d374f02

Please sign in to comment.