Skip to content

Commit 16eeedc

Browse files
authored
GitHub action to check that the PR version is >= the version of main (#30)
1 parent 46c617a commit 16eeedc

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
on:
2+
pull_request:
3+
branches: [main]
4+
5+
name: enforce-version-increment
6+
7+
jobs:
8+
enforce-version-increment:
9+
runs-on: ubuntu-latest
10+
11+
env:
12+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
13+
R_KEEP_PKG_SOURCE: yes
14+
15+
steps:
16+
- uses: r-lib/actions/setup-r@v2
17+
with:
18+
use-public-rspm: true
19+
20+
- uses: actions/checkout@v3
21+
- run: echo "VERSION_PR=$(cat DESCRIPTION | grep Version | cut -d ' ' -f 2)" >> $GITHUB_ENV
22+
23+
- uses: actions/checkout@v3
24+
with:
25+
ref: main
26+
- run: echo "VERSION_MAIN=$(cat DESCRIPTION | grep Version | cut -d ' ' -f 2)" >> $GITHUB_ENV
27+
28+
- name: Check version of PR > version of main
29+
run: |
30+
if (Sys.getenv("VERSION_PR") <= Sys.getenv("VERSION_MAIN")) {
31+
stop("PR must increment package version before it can merge to main.")
32+
}
33+
shell: Rscript {0}

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Authors@R: c(
99
role = c("aut"), comment = c(ORCID = "0000-0002-1256-3375")),
1010
person("Damjan", "Vukcevic", email = "damjan@vukcevic.net",
1111
role = c("aut"), comment = c(ORCID = "0000-0001-7780-9586")))
12-
Version: 0.0.0.9000
12+
Version: 0.0.1
1313
Depends: R (>= 2.10)
1414
LazyData: true
1515
License: GPL-3

0 commit comments

Comments
 (0)