Skip to content

Commit

Permalink
Merge pull request #302 from kedhammar/ci
Browse files Browse the repository at this point in the history
Add GitHub action to check versionlog has been updated for a PR
  • Loading branch information
kedhammar authored Jan 17, 2024
2 parents 413be84 + 9246cb2 commit 754ce38
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/check-log.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check VERSIONLOG.MD has been updated
on: [pull_request]

jobs:
check-versionlog:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Check for VERSIONLOG.MD changes
id: versionlog_check
# 1) Find the common ancestor between the current HEAD and the base branch
# 2) Then see if the versionlog has been updated in the PR since it diverged
# from the common ancestor
run: |
PR_BASE_SHA=$(git merge-base HEAD ${{ github.event.pull_request.base.sha }})
FILE_CHANGED=$(git diff --name-only $PR_BASE_SHA HEAD | grep 'VERSIONLOG.md' || true)
if [ -n "$FILE_CHANGED" ]; then
echo "VERSIONLOG.MD has been changed."
else
echo "VERSIONLOG.MD has NOT been changed."
exit 1 # Fail the workflow if no changes in VERSIONLOG.MD
fi
7 changes: 1 addition & 6 deletions .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: lint-code
name: Lint code
on: [push, pull_request]

# Cancel if a newer run is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
# Use ruff to check for code style violations
ruff-check:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ build/
.*_cache/
*.swp
__pycache__
node_modules
4 changes: 4 additions & 0 deletions VERSIONLOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Scilifelab_epps Version Log

## 20230111.1

Add CI-check to see versionlog is updated for a given pull request

## 20231220.1

Fix bug with verify index EPP
Expand Down

0 comments on commit 754ce38

Please sign in to comment.