From 14cfeb37be15534e4c5955ca4ea752802c9366f7 Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Sun, 28 Jul 2024 16:09:00 -0400 Subject: [PATCH 1/4] Add failed test --- tests/testthat/test-data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-data.R b/tests/testthat/test-data.R index d4d3824..b5f97b4 100644 --- a/tests/testthat/test-data.R +++ b/tests/testthat/test-data.R @@ -2,5 +2,5 @@ test_that("tax dataset version is latest version", { latest_version <- subset(ebirdtaxonomyversion(), latest == TRUE)$authorityVer tax <- rebird::tax dataset_tax_version <- attr(tax, "version") - expect_equal(latest_version, dataset_tax_version) + expect_equal(latest_version, "dataset_tax_version") }) From ff8a43c931d0eee350c6f65169cf5d1598f2e41b Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Sun, 28 Jul 2024 19:25:34 -0400 Subject: [PATCH 2/4] Test reusable workflow --- .github/workflows/R-CMD-check.yaml | 3 +++ .github/workflows/taxonomy-version-check.yaml | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index a3ac618..5cc09a4 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -47,3 +47,6 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true + + - uses: ./.github/workflows/taxonomy-version-check.yaml + if: failure() diff --git a/.github/workflows/taxonomy-version-check.yaml b/.github/workflows/taxonomy-version-check.yaml index 51d1915..a6993eb 100644 --- a/.github/workflows/taxonomy-version-check.yaml +++ b/.github/workflows/taxonomy-version-check.yaml @@ -8,23 +8,19 @@ env: There is an update to the eBird taxonomy. The `rebird::tax` dataset and documentation needs to be updated. on: - workflow_run: - workflows: ["R-CMD-check"] - types: - - completed + workflow_call: jobs: taxonomy-version-check-job: outputs: check-failed: ${{ steps.check-taxonomy-version.outputs.failed }} runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'failure' }} steps: - name: check-taxonomy-version-step id: check-taxonomy-version run: | Rscript -e "testthat::test_file('tests/testthat/test-data.R', load_package = 'source', stop_on_failure = TRUE)" && echo "failed=false" >> "$GITHUB_OUTPUT" || echo "failed=true" >> "$GITHUB_OUTPUT" - + check-and-create-issue-job: needs: taxonomy-version-check-job if: needs.taxonomy-version-check-job.outputs.check-failed == 'true' From a6cf1efe0097ee86289731231e9f62534f0a81b2 Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Mon, 12 Aug 2024 09:47:25 -0400 Subject: [PATCH 3/4] Use scheduled R-CMD-check --- .github/workflows/R-CMD-check.yaml | 8 +-- .github/workflows/taxonomy-version-check.yaml | 67 ------------------- man/ebirdtaxonomyversion.Rd | 3 +- tests/testthat/test-data.R | 2 +- 4 files changed, 6 insertions(+), 74 deletions(-) delete mode 100644 .github/workflows/taxonomy-version-check.yaml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 5cc09a4..7f33a21 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -5,6 +5,9 @@ on: branches: [main, master] pull_request: branches: [main, master] + schedule: + - cron: + '0 8 1,15 * *' # At 08:00AM on 1st and 15th of month name: R-CMD-check @@ -29,7 +32,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -47,6 +50,3 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true - - - uses: ./.github/workflows/taxonomy-version-check.yaml - if: failure() diff --git a/.github/workflows/taxonomy-version-check.yaml b/.github/workflows/taxonomy-version-check.yaml deleted file mode 100644 index a6993eb..0000000 --- a/.github/workflows/taxonomy-version-check.yaml +++ /dev/null @@ -1,67 +0,0 @@ -name: taxonomy-version-check - -env: - ISSUE_TITLE: 'eBird taxonomy has updated' - ISSUE_BODY: | - This issue has been opened by the GitHub Action workflow `taxonomy-version-check`. - - There is an update to the eBird taxonomy. The `rebird::tax` dataset and documentation needs to be updated. - -on: - workflow_call: - -jobs: - taxonomy-version-check-job: - outputs: - check-failed: ${{ steps.check-taxonomy-version.outputs.failed }} - runs-on: ubuntu-latest - steps: - - name: check-taxonomy-version-step - id: check-taxonomy-version - run: | - Rscript -e "testthat::test_file('tests/testthat/test-data.R', load_package = 'source', stop_on_failure = TRUE)" && echo "failed=false" >> "$GITHUB_OUTPUT" || echo "failed=true" >> "$GITHUB_OUTPUT" - - check-and-create-issue-job: - needs: taxonomy-version-check-job - if: needs.taxonomy-version-check-job.outputs.check-failed == 'true' - runs-on: ubuntu-latest - steps: - - name: check-issue-step - id: check-issue - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const issueTitle = process.env.ISSUE_TITLE; - const { owner, repo } = context.repo; - - const issues = await github.rest.issues.listForRepo({ - owner, - repo, - state: 'open', - }); - - const existingIssue = issues.data.find(issue => issue.title === issueTitle); - - if (existingIssue) { - core.setOutput('exists', 'true'); - } else { - core.setOutput('exists', 'false'); - } - - - name: create-issue-step - if: ${{ steps.check-issue.outputs.exists == 'false' }} - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const issueTitle = process.env.ISSUE_TITLE; - const issueBody = process.env.ISSUE_BODY; - const { owner, repo } = context.repo; - - await github.rest.issues.create({ - owner, - repo, - title: issueTitle, - body: issueBody, - }); diff --git a/man/ebirdtaxonomyversion.Rd b/man/ebirdtaxonomyversion.Rd index 1dbac67..b413002 100644 --- a/man/ebirdtaxonomyversion.Rd +++ b/man/ebirdtaxonomyversion.Rd @@ -18,9 +18,8 @@ supply the key, and to avoid accidentally sharing it publicly.} data.frame containing the collected information: "authorityVer": Character of version. - -"latest": Boolean indicating whether `authorityVer`` is the latest taxonomy version +"latest": Boolean indicating whether `authorityVer` is the latest taxonomy version } \description{ Returns a data.frame of available version numbers of the eBird taxonomy diff --git a/tests/testthat/test-data.R b/tests/testthat/test-data.R index b5f97b4..d4d3824 100644 --- a/tests/testthat/test-data.R +++ b/tests/testthat/test-data.R @@ -2,5 +2,5 @@ test_that("tax dataset version is latest version", { latest_version <- subset(ebirdtaxonomyversion(), latest == TRUE)$authorityVer tax <- rebird::tax dataset_tax_version <- attr(tax, "version") - expect_equal(latest_version, "dataset_tax_version") + expect_equal(latest_version, dataset_tax_version) }) From dfc92125603c7f079a0c7410403640f77692e39b Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Mon, 12 Aug 2024 10:04:48 -0400 Subject: [PATCH 4/4] Bump version and update changelog --- DESCRIPTION | 2 +- NEWS.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2192e9e..a694f4c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: rebird -Version: 1.3.9005 +Version: 1.3.9006 Title: R Client for the eBird Database of Bird Observations Description: A programmatic client for the eBird database (), including functions for searching for bird diff --git a/NEWS.md b/NEWS.md index 3699087..a0d8aaa 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ -# rebird 1.3.9005 +# rebird 1.3.9006 +- Added `ebirdtaxonomyversion()` which retrieves data on available taxonomy versions. +The version is added as an attribute to `rebird::tax` (#131). - Added `ebirdchecklist()`, which lets you view individual checklists (thanks @RichardLitt and @Rafnuss, #108). - Made `ebirdregioncheck()`, `ebirdhotspot()`, `ebirdloc()` defunct. - API tests now use `vcr`, which saves "cassettes" of the tests which can be played