Skip to content

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

Merged
Schiano-NOAA merged 2 commits into
devfrom
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 into
devfrom
copilot/add-github-action-for-output-update

Conversation

Copy link
Copy Markdown
Contributor

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
Contributor 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
Schiano-NOAA added a commit that referenced this pull request Apr 15, 2026
* [Fix] bugs identified in plot_recruitment (#220)

* add in optional ggplot args

* adjust process data so grouping is correctly adjusted based on model condition and grouping

* change default model as 1 from NA

* set plot to look for only recruitment and not rec exp or obs

* allow users to access ggplot geom args

* fix maggritr in pipe

* Update "SSB" to "SB" in captions/alt text/key quantities csvs

* [Fix] plot_indices (#221)

* initial commit of new obs v pred plot

* adjust process data so it converts all indexed data to character to function even when input values are numeric per #212

* update plot indices to use new plot_obsvpred function and adjust based on needs

* update documentation for package

* adjust plot_indices where nfleet = 1 and update test to remove new file produced

* add missing dependency

* [Fix] plot_spawning_biomass when user wants to use DERIVED_QUANTITIES from SS3 (#222)

* adjust reference line to take our era and use plot data instead

* adjust reference label to replace underscore with space

* update ref line documentation

* fix commit from overwrite when rebasing

* fixes to plot including adjusting missing legend

* add back in ggplot options

* adjust plot ts to stop error from color label

* adjust conditions where legend is remove

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

* Initial plan

* Add GitHub Action to update example_data when convert_output.R changes

Agent-Logs-Url: https://github.com/nmfs-ost/stockplotr/sessions/16147f90-2416-4af0-a517-a1d297703e33

Co-authored-by: Schiano-NOAA <125507018+Schiano-NOAA@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Schiano-NOAA <125507018+Schiano-NOAA@users.noreply.github.com>

* Update tests to remove key_quantities.csv when complete

* Address plot_recruitment_deviations() documentation review suggestions (#227)

* Address most suggestions as per #198

* Add details section

* Update documentation

* update version

---------

Co-authored-by: sbreitbart-NOAA <sophie.breitbart@noaa.gov>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
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