From e534c85cd52468fd42891871ea8181a6c0ecb02f Mon Sep 17 00:00:00 2001 From: Kathryn Doering Date: Tue, 25 Jul 2023 09:57:06 -0400 Subject: [PATCH 1/3] Add GHA workflow to autorender readme --- .github/workflows/render-readme.yml | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/render-readme.yml diff --git a/.github/workflows/render-readme.yml b/.github/workflows/render-readme.yml new file mode 100644 index 0000000..df99dfa --- /dev/null +++ b/.github/workflows/render-readme.yml @@ -0,0 +1,40 @@ +# Render readme, based on +# https://raw.githubusercontent.com/r-lib/actions/master/.github/workflows/render-readme.yaml +name: Render README +on: + push: + branches: main + paths: + - 'README.Rmd' + +jobs: + render: + name: Render README + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + - uses: r-lib/actions/setup-r@v2 + - uses: r-lib/actions/setup-pandoc@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: | + any::rmarkdown + any::devtools + - name: Install local package + run: | + devtools::install_local(".") + shell: Rscript {0} + - name: Render README + run: Rscript -e 'rmarkdown::render("README.Rmd")' + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + commit-message: 'docs: update readme' + branch: update-readme + title: 'Update readme' + body: | + Auto-generated by [render-readme.yml](https://github.com/nmfs-fish-tools/nmfspalette/tree/main/.github/workflows/render-readme.yml). + From b9f62429d59483a7667d28c60fb7df75502d285e Mon Sep 17 00:00:00 2001 From: Kathryn Doering Date: Tue, 25 Jul 2023 10:22:21 -0400 Subject: [PATCH 2/3] fix: org names, updates to README.Rmd --- README.Rmd | 29 +++++++++++++---------------- _pkgdown.yml | 4 ++-- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/README.Rmd b/README.Rmd index a152863..551b0ba 100644 --- a/README.Rmd +++ b/README.Rmd @@ -4,7 +4,7 @@ output: variant: gfm --- - + ```{r, echo = FALSE, warning=FALSE, message=FALSE} knitr::opts_chunk$set( @@ -16,32 +16,32 @@ knitr::opts_chunk$set( require(ggplot2) ``` -# nmfspalette logo with an image of a fish in multiple palette colors +# nmfspalette logo with an image of a fish in multiple palette colors -an R color palette for `ggplot2` using NOAA Fisheries branding colors +An R color palette for `{ggplot2}` using NOAA Fisheries branding colors -![R-CMD-check](https://github.com/nmfs-general-modeling-tools/nmfspalette/workflows/R-CMD-check/badge.svg) +![R-CMD-check](https://github.com/nmfs-fish-tools/nmfspalette/workflows/call-r-cmd-check/badge.svg) ************** -This implements these [steps](https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2) to create a `ggplot2` compatible palette according to NOAA Fisheries branding. The branding materials can be found [here](https://drive.google.com/drive/folders/1pcMRQHGdzX4NfsiDNTCYIBpRyP1-F57J) (NOAA internal only). +`{nmfspalette}` implements these [steps](https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2) to create a `{ggplot2}` compatible palette according to [NOAA Fisheries branding](https://drive.google.com/drive/folders/1pcMRQHGdzX4NfsiDNTCYIBpRyP1-F57J)(NOAA internal only). ## Installation -To install from Github use the following: +To install from GitHub use the following: ```{r, message=FALSE} -remotes::install_github("nmfs-general-modeling-tools/nmfspalette") -library(nmfspalette) +remotes::install_github("nmfs-fish-tools/nmfspalette") ``` ## Contributing -We welcome contributions to `nmfspalette`. You are welcome to make any changes you would like on a fork and submit a pull request. For more substantial changes or to create a branch, please contact christine.stawitz@noaa.gov (NOAA Affiliates only). We ask that all contributors adhere to The NOAA Fisheries Integrated Toolbox [code of conduct](https://github.com/nmfs-fish-tools/Resources/blob/master/CONTRIBUTING.md). +We welcome contributions to `{nmfspalette}`. You are welcome to make any changes you would like on a fork and submit a pull request. For more substantial changes or to create a branch, please contact christine.stawitz@noaa.gov (NOAA Affiliates only). We ask that all contributors adhere to The NOAA Fisheries Integrated Toolbox [code of conduct](https://github.com/nmfs-fish-tools/Resources/blob/main/CONTRIBUTING.md). ## Usage To learn how to use `nmfspalette`, please check out the [interactive `learnr` tutorial](https://connect.fisheries.noaa.gov/colors/). +Extract an interpolated color palette from the default "oceans" palette. -Extract an interpolated color palette from the default "oceans" palette. You can change the number of colors (10 shown below). +You can change the number of colors (10 shown below). ```{r, default_pal} nmfspalette::nmfs_palette("oceans")(10) ``` @@ -86,13 +86,13 @@ nmfspalette::display_nmfs_palette("regional", 6) ## Examples -In addition to `nmfs_palette` and `display_nmfs_palette` to get in-built palettes, you can extract colors by name. Please see the NOAA Fisheries Branding guide for color names, all spaces are replaced with underscores in the color names. +In addition to `nmfs_palette` and `display_nmfs_palette` to get palettes, you can extract colors by name. Please see the [NOAA Fisheries Branding guide](https://drive.google.com/drive/folders/1pcMRQHGdzX4NfsiDNTCYIBpRyP1-F57J)(NOAA internal only) for color names. Here, all spaces are removed in the color names. ```{r, nmfs_cols} nmfspalette::nmfs_cols("processblue") ``` -To use the palettes with `ggplot2`, the `scale_color_nmfs()` and `scale_fill_nmfs()` functions are provided. If no argument is given to `scale_color_nmfs()`, a default ("oceans") is used: +To use the palettes with `{ggplot2}`, the `scale_color_nmfs()` and `scale_fill_nmfs()` functions are provided. If no argument is given to `scale_color_nmfs()`, a default ("oceans") is used: ```{r, default_plot, fig.height=3} p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + @@ -101,7 +101,7 @@ p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + p ``` -`scale_fill_nmfs` does not have a default and therefore requires a named argument for now, this is an example using the "crustacean" palette +`scale_fill_nmfs()` does not have a default and therefore requires a named argument, this is an example using the "crustacean" palette: ```{r, scale_fill_example, fig.height=3} ggplot(faithfuld, aes(waiting, eruptions)) + geom_raster(aes(fill = density)) + @@ -114,9 +114,6 @@ ggplot(faithfuld, aes(waiting, eruptions)) + “The United States Department of Commerce (DOC) GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. DOC has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any claims against the Department of Commerce stemming from the use of its GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.” -- This project code is made available through GitHub but is managed by NOAA at - https://vlab.ncep.noaa.gov/redmine/projects/integrated-fisheries-toolbox/files - ***** ******* NOAA Fisheries diff --git a/_pkgdown.yml b/_pkgdown.yml index 34e629d..303c3ac 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -20,12 +20,12 @@ navbar: github: text: Source Code icon: fab fa-github fa-lg - href: https://github.com/nmfs-general-modeling-tools/nmfspalette/ + href: https://github.com/nmfs-fish-tools/nmfspalette/ issue: text: Issues icon: fas fa-question-circle fa-lg - href: https://github.com/nmfs-general-modeling-tools/nmfspalette/issues/ + href: https://github.com/nmfs-fish-tools/nmfspalette/issues/ articles: text: Vignettes From 82543500ab83d43494bbb53d27732d2c99138aec Mon Sep 17 00:00:00 2001 From: Kathryn Doering Date: Tue, 25 Jul 2023 10:33:36 -0400 Subject: [PATCH 3/3] updates to GitHub actions Remove duplicative r cmd check workflow, refine build triggers. --- .github/workflows/call-r-cmd-check-full.yml | 15 --------------- .github/workflows/call-r-cmd-check.yml | 6 +++--- .github/workflows/call-update-pkgdown.yml | 8 ++++---- 3 files changed, 7 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/call-r-cmd-check-full.yml diff --git a/.github/workflows/call-r-cmd-check-full.yml b/.github/workflows/call-r-cmd-check-full.yml deleted file mode 100644 index 83d9510..0000000 --- a/.github/workflows/call-r-cmd-check-full.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Run r cmd check -name: call-r-cmd-check -# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows -on: -# The default build trigger is to run the action on every push and pull request, for any branch - push: - pull_request: - # To run the default repository branch weekly on sunday, uncomment the following 2 lines - #schedule: - #- cron: '0 0 * * 0' -jobs: - call-workflow: - uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@main - with: - use_full_build_matrix: true diff --git a/.github/workflows/call-r-cmd-check.yml b/.github/workflows/call-r-cmd-check.yml index 1f4d5d7..74f46cd 100644 --- a/.github/workflows/call-r-cmd-check.yml +++ b/.github/workflows/call-r-cmd-check.yml @@ -5,9 +5,9 @@ on: # The default build trigger is to run the action on every push and pull request, for any branch push: pull_request: - # To run the default repository branch weekly on sunday, uncomment the following 2 lines - #schedule: - #- cron: '0 0 * * 0' + # To run the default repository branch weekly (At 12:23am on Sunday) on sunday, uncomment the following 2 lines + schedule: + - cron: '23 0 * * 0' jobs: call-workflow: uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@main diff --git a/.github/workflows/call-update-pkgdown.yml b/.github/workflows/call-update-pkgdown.yml index 58c9c15..2c7b340 100644 --- a/.github/workflows/call-update-pkgdown.yml +++ b/.github/workflows/call-update-pkgdown.yml @@ -3,10 +3,10 @@ name: call-update-pkgdown # on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows on: -# this workflow runs on pushes to main or master or any time a new tag is pushed +# this workflow runs on pushes to main push: - branches: [main, master] - tags: ['*'] + branches: main + jobs: call-workflow: - uses: nmfs-fish-tools/ghactions4r/.github/workflows/update-pkgdown.yml@main + uses: nmfs-fish-tools/ghactions4r/.github/workflows/update-pkgdown.yml@main \ No newline at end of file