Skip to content

Merge pull request #550 from ropensci/available_dates #130

Merge pull request #550 from ropensci/available_dates

Merge pull request #550 from ropensci/available_dates #130

on:
push:
branches: [main, master]
name: update codemeta
permissions: write-all
jobs:
codemetar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create this folder to silence warning
run: mkdir -p ~/.nix-defexpr/channels
- name: config bot user and check for DESCRIPTION changes
id: check_desc
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
# Fetch enough history to compare
git fetch origin ${{ github.ref }} --depth=2
# Check if DESCRIPTION was modified in this push
if git diff --name-only ${{ github.event.before }} HEAD | grep -q '^DESCRIPTION$'; then
echo "has_changes=true" >> $GITHUB_ENV
else
echo "has_changes=false" >> $GITHUB_ENV
fi
- name: Install Nix
if: env.has_changes == 'true'
uses: DeterminateSystems/nix-installer-action@main
- uses: cachix/cachix-action@v15
if: env.has_changes == 'true'
with:
name: rstats-on-nix
- name: Update codemeta
if: env.has_changes == 'true'
run: |
nix-shell --quiet default.nix --run "Rscript -e 'codemetar::write_codemeta()'"
- name: Commit and push results
if: env.has_changes == 'true'
run: |
git add codemeta.json
if ! git diff --staged --quiet; then
git commit -m 'Re-build codemeta.json'
git push https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git HEAD:${{ github.ref }}
else
echo "No changes to commit"
fi