Skip to content

Update BODC_tables_generator.py #28

Update BODC_tables_generator.py

Update BODC_tables_generator.py #28

name: Update BODC tables used in the package
on:
# Scheduled to run on the 1st of each month
#schedule:
#- cron: '0 0 1 * *' # Runs at midnight UTC on the 1st of each month
# For testing purposes, also trigger on push to main branch
push:
branches:
- develop
jobs:
generate-table:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.2'
# Step 3: Install required dependencies
- name: Install dependencies
run: |
pip install pandas pysema requests numpy
# Step 4: Run the Python script that generates the table
- name: Run table generator script
run: python files/BODC_tables_generator.py
# Configure git
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Commit the changes
- name: Commit changes
run: |
git add .
git commit -m "Automated commit by GitHub Action"
# Push changes back to the branch
- name: Push changes
run: git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Step 5: Set up R environment
#- name: Set up R
# uses: r-lib/actions/setup-r@v2
#with:
# r-version: ${{ matrix.config.r }}
# Step 6: Install R packages
#- name: Install R packages
# run: |
# Rscript -e "install.packages('usethis', repos='https://cran.rstudio.com/')"
# Rscript -e "install.packages('devtools', repos='https://cran.rstudio.com/')"
# Step 7: Read the CSV files in R and run the usethis::use_data() commands
#- name: Process CSV files with R
# run: |
# Rscript -e "BODCunits <- read.csv("files/BODCunits.csv")"
# Rscript -e "BODCvalues <- read.csv("files/BODCvalues.csv")"
#Rscript -e "BODCparameters <- read.csv("files/BODCparameters.csv")"
#Rscript -e "usethis::use_data(BODCunits, overwrite = TRUE)"
# Rscript -e "usethis::use_data(BODCvalues, overwrite = TRUE)"
#Rscript -e "usethis::use_data(BODCparameters, overwrite = TRUE)"
# Step 8: Run devtools::document() to update R package documentation
#- name: Update R documentation
# run: |
# Rscript -e "devtools::document()"