Skip to content

Commit

Permalink
Add
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-va committed Nov 5, 2024
1 parent 0df0e6f commit 9e2caa5
Showing 1 changed file with 49 additions and 31 deletions.
80 changes: 49 additions & 31 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,11 @@ jobs:
uses: actions/dependency-review-action@v4


check-changelog:
name: "Check CHANGELOG"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch full history for comparison
fetch-depth: 0
- name: Determine if branch is a feature branch
id: check_feature_branch
run: |
if [[ "${{ github.head_ref || github.ref_name }} " =~ ^feature/* ]]; then
echo "is_feature=true" >> $GITHUB_ENV
else
echo "is_feature=false" >> $GITHUB_ENV
fi
- name: Check if CHANGELOG.md has changed
if: env.is_feature == 'true'
run: |
# Compare the CHANGELOG.md file in the current branch with the `develop` branch
if git diff --name-only origin/develop...HEAD | grep -q '^CHANGELOG.md$'; then
echo "CHANGELOG.md has been updated."
else
echo "CHANGELOG.md has not been updated."
exit 1
fi
install-ui:
name: "Install UI"
runs-on: ubuntu-latest
needs:
- dependency-review
- check-changelog
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -165,7 +135,6 @@ jobs:
runs-on: ubuntu-latest
needs:
- dependency-review
- check-changelog
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -346,3 +315,52 @@ jobs:
run: |
kill $(cat api.pid)
docker compose down
check-changelog:
name: "Check CHANGELOG"
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch full history for comparison
fetch-depth: 0
- name: Determine if branch is a feature branch
id: check_feature_branch
run: |
if [[ "${{ github.head_ref || github.ref_name }} " =~ ^feature/* ]]; then
echo "is_feature=true" >> $GITHUB_ENV
else
echo "is_feature=false" >> $GITHUB_ENV
fi
- name: Check if CHANGELOG.md has changed
if: env.is_feature == 'true'
run: |
# Compare the CHANGELOG.md file in the current branch with the `develop` branch
if git diff --name-only origin/develop...HEAD | grep -q '^CHANGELOG.md$'; then
echo "CHANGELOG.md has been updated."
else
echo "CHANGELOG.md has not been updated."
exit 1
fi
require-single-commit:
name: "Require Single Commit"
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Count commits
id: count_commits
run: |
commit_count=$(git rev-list --count HEAD ^origin/${{ github.event.pull_request.base.ref }})
echo "commit_count=$commit_count" >> $GITHUB_ENV
- name: Fail if more than one commit
if: env.commit_count > 1
run: |
echo "Pull request contains more than one commit ($commit_count commits). Please squash your commits."
exit 1

0 comments on commit 9e2caa5

Please sign in to comment.