Skip to content

Commit

Permalink
Merge pull request #251 from UCD-SERG/version-check
Browse files Browse the repository at this point in the history
adding version check for pull requests
  • Loading branch information
kristinawlai authored Sep 12, 2024
2 parents d85b377 + a7c809d commit eb0862c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
58 changes: 58 additions & 0 deletions .github/workflows/version-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
on:
pull_request:
branches:
- main

name: Version increment check

jobs:
version-check:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ github.token }}
permissions:
pull-requests: read

steps:

- name: checkout working HEAD
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
sparse-checkout: |
DESCRIPTION
path: working

- name: checkout base HEAD
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
sparse-checkout: |
DESCRIPTION
path: compare

- name: show files
run: |
ls -lR working compare
echo "\nWORKING:\n"
cat working/DESCRIPTION
echo "\nCOMPARE:\n"
cat compare/DESCRIPTION
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: compare versions
run: |
Rscript -e " \
install.packages('desc'); \
working_version <- desc::desc_get_version('working/DESCRIPTION'); \
message('PR branch version: ', working_version); \
compare_version <- desc::desc_get_version('compare/DESCRIPTION'); \
message('main branch version: ', compare_version); \
stopifnot(working_version > compare_version); \
"
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: serocalculator
Type: Package
Title: Estimating Infection Rates from Serological Data
Version: 1.2.0.9000
Version: 1.2.0.9001
Authors@R: c(
person(given = "Peter", family = "Teunis", email = "[email protected]", role = c("aut", "cph"), comment = "Author of the method and original code."),
person(given = "Kristina", family = "Lai", email = "[email protected]", role = c("aut", "cre")),
Expand Down

0 comments on commit eb0862c

Please sign in to comment.