Skip to content

should not reopen pr's now #27

should not reopen pr's now

should not reopen pr's now #27

# Create inst/default.nix
on:
push:
branches: [main, master]
name: create_inst_default.nix
permissions: write-all
jobs:
create-default-nix:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Get latest commit hash
id: get_latest_commit
run: echo "LATEST_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Generate .inst/extdata/default.nix
run: |
nix-shell ./inst/extdata/default.nix --run "Rscript -e \"library(rix);rix('4.3.1', git_pkgs = list(package_name = 'rix', repo_url = 'https://github.com/b-rodrigues/rix/', branch_name = 'master', commit = '${{ env.LATEST_COMMIT_HASH }}'), ide = 'other', project_path = 'inst/extdata', overwrite = TRUE)\""
- name: Check if PR exists
id: check_pr
run: |
PR=$(gh pr list -S 'Update default.nix' --json number --jq '.[0].number')
echo "PR_NUMBER=$PR" >> $GITHUB_ENV
- name: Push changes to update_default.nix branch
run: |
git push origin master:update_default.nix --force
- name: Create Pull Request
if: env.PR_NUMBER == ''
uses: peter-evans/create-pull-request@v6
with:
branch: update_default.nix
title: 'Update default.nix'
body: 'Automated PR to update default.nix'
base: master
branch-suffix: ''