Skip to content

Add GitHub Action to regenerate example_data when convert_output.R changes#229

Merged
Schiano-NOAA merged 2 commits intodevfrom
copilot/add-github-action-for-output-update
Apr 9, 2026
Merged

Add GitHub Action to regenerate example_data when convert_output.R changes#229
Schiano-NOAA merged 2 commits intodevfrom
copilot/add-github-action-for-output-update

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 9, 2026

data/example_data.rda had no automated path to stay in sync when convert_output.R was updated — it required manual execution of data-raw/DATASET.R.

Changes

  • .github/workflows/update-example-data.yml — new workflow that:
    • Triggers on push to main with path filter R/convert_output.R, plus workflow_dispatch
    • Installs R dependencies (including usethis) via r-lib/actions
    • Regenerates example_data using the same pattern as data-raw/DATASET.R to preserve the correct object name in the .rda:
      example_data <- stockplotr::convert_output(file = "inst/extdata/Report.sso")
      usethis::use_data(example_data, overwrite = TRUE)
    • Commits data/example_data.rda as github-actions[bot] with [skip ci] to avoid loops; skips the commit entirely if the data is unchanged
    • Requires contents: write permission to push back to the branch

Copilot AI linked an issue Apr 9, 2026 that may be closed by this pull request
@Schiano-NOAA Schiano-NOAA changed the base branch from main to dev April 9, 2026 20:34
@nmfs-ost nmfs-ost deleted a comment from github-actions bot Apr 9, 2026
Copilot AI changed the title [WIP] Add GitHub Action to update example data on release Add GitHub Action to regenerate example_data when convert_output.R changes Apr 9, 2026
Copilot AI requested a review from Schiano-NOAA April 9, 2026 20:35
@Schiano-NOAA
Copy link
Copy Markdown
Collaborator

@copilot by using this action, is the script data-raw/DATASET.R unnecessary?

Copy link
Copy Markdown
Author

Copilot AI commented Apr 9, 2026

@copilot by using this action, is the script data-raw/DATASET.R unnecessary?

Not entirely — data-raw/DATASET.R still serves two purposes:

  1. R package convention / documentation: The data-raw/ directory is the standard place to keep scripts that document how a package's data/ files were generated. Tools like usethis::use_data_raw() create it for exactly this reason, and CRAN/package reviewers expect it.
  2. Local development: Developers can still run it by hand when they want to regenerate the data locally without pushing to main.

The GitHub Action automates the same regeneration in CI, but keeping data-raw/DATASET.R is still recommended as the human-readable record of how example_data.rda is produced. You could remove the devtools::install_github(...) line from it (since locally you'd use devtools::load_all() instead), but the script itself is worth keeping.

@Schiano-NOAA Schiano-NOAA marked this pull request as ready for review April 9, 2026 20:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Code Metrics Report

Coverage Code to Test Ratio Test Execution Time
69.3% 1:0.2 4m30s

Reported by octocov

@Schiano-NOAA Schiano-NOAA merged commit e15a0d1 into dev Apr 9, 2026
2 checks passed
@Schiano-NOAA Schiano-NOAA deleted the copilot/add-github-action-for-output-update branch April 9, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gh Action to update std output on release

2 participants