480 bump version to 210 #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Version Bump | |
on: | |
pull_request: | |
branches: | |
- devel | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev libssl-dev | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Install R dependencies | |
run: Rscript -e 'install.packages(c("devtools", "usethis", "desc"), repos = "http://cran.rstudio.com/")' | |
- name: Get current version | |
id: get_current_version | |
run: echo "::set-output name=current_version::$(grep Version DESCRIPTION | cut -d' ' -f2)" | |
- name: Get previous version from main branch | |
run: | | |
git fetch origin main | |
git checkout origin/main -- DESCRIPTION | |
echo "::set-output name=previous_version::$(grep Version DESCRIPTION | cut -d' ' -f2)" | |
id: get_previous_version | |
- name: Compare versions | |
run: | | |
echo "Current version: ${{ steps.get_current_version.outputs.current_version }}" | |
echo "Previous version: ${{ steps.get_previous_version.outputs.previous_version }}" | |
if [[ "${{ steps.get_current_version.outputs.current_version }}" == "${{ steps.get_previous_version.outputs.previous_version }}" ]]; then | |
echo "Version has not been changed." | |
exit 1 | |
else | |
echo "Version has been changed." | |
fi | |
- name: Add comment if version not changed | |
if: failure() | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
github.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: 'The version of the package in the DESCRIPTION file has not been changed. Please update the version.' | |
}) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |