Skip to content

Weekly harvest workflow that opens a pull request #9

Closed

Description

@larnsce

Goal

.github/workflows/harvest.yaml: a weekly harvest whose output arrives as one pull request for the maintainer to merge.

Rewritten 2026-09-04 per dev/decisions-2026-09.md. Start from .github/workflows-pending/harvest.yaml on the closed PR #15 branch, minus the direct push, the registry sync and the failure issue.

Workflow

  • Triggers: schedule cron 0 3 * * 1 and workflow_dispatch
  • Steps: checkout main; r-lib/actions setup-r and setup-r-dependencies with needs: harvest; Rscript data-raw/harvest.R with the GitHub backend and LANG=C.UTF-8; roxygen2::roxygenise(); testthat::test_local(stop_on_failure = TRUE) as the gate; if anything under R/sysdata.rda, inst/extdata/, data-raw/packages.json, data-raw/harvest_report.md, man/ or DESCRIPTION changed, open or update a pull request on a fixed branch harvest (for example with peter-evans/create-pull-request), body from harvest_report.md
  • The built-in GITHUB_TOKEN is enough. A pull request opened with it triggers no pull_request workflows, so the gate runs inside this job and R-CMD-check plus pkgdown run on main after the merge. Do not make R-CMD-check a required status on main, or the harvest PR can never merge.
  • Failure surfacing: a failed run is red in the Actions tab and opens no PR. No issue automation.

Acceptance criteria

  • A workflow_dispatch run opens a pull request with a bumped version and date, or reports no changes
  • Merging that pull request rebuilds the site through the pkgdown workflow
  • A forced gate failure (temporarily break a schema test) leaves the run red and opens no PR

Activity

  1. self-assigned this
    on Jul 8, 2026
  2. larnsce commented on Jul 18, 2026

    @larnsce
    ContributorAuthor

    Premortem findings for this issue (advisory, non-blocking)

    From the 2026-07-18 premortem (report in docs/ on branch claude/implementation-premortem-jd5udn):

    The gate is schema tests, and schema tests assert names, types, and non-emptiness, never values. NA is a valid entry, so a run that half-parses several packages into blank DOIs and wrong tiers passes the gate, commits to main, and publishes to the site. The failure-surfacing path (auto-opened harvest-failure issues) only works if a human sees the issue; in a repo with one part-time maintainer that is not guaranteed, and the org PAT for the registry sync expires silently.

    Suggestions:

    • Add content-level checks to the gate: fail or at least alert on week-over-week increases in problems-tibble rows, NA rates in doi, tier, or description columns, and unexplained tier changes.
    • Route harvest failures to a channel a human actually reads (an email step, or GitHub notification settings verified for the harvest-failure label), and treat a harvest-failure issue that is open more than 14 days with only bot comments as its own alarm.
    • Put the PAT expiry date on a calendar, or replace the PAT with a GitHub App installation token.
    • After the sync step, assert the registry repo's packages.json equals the harvester's copy; a non-empty diff for more than a week means the sync is broken.

    Generated by Claude Code

  3. changed the title [-]Automate the weekly harvest[/-] [+]Weekly harvest workflow that opens a pull request[/+] on Sep 4, 2026
  4. added a commit that references this issue on Sep 9, 2026
  5. larnsce commented on Sep 9, 2026

    @larnsce
    ContributorAuthor

    First workflow_dispatch run after the merge: run 34355264180.

    Everything the issue specifies worked, except one organisation setting.

    What passed

    • The harvest ran on the runner against the GitHub backend
    • roxygen2::roxygenise() regenerated the documentation
    • testthat::test_local(stop_on_failure = TRUE) passed as the gate, inside the job, which is where it has to run because a pull request opened with the built-in token triggers no pull_request workflows
    • The harvest branch was pushed, one commit ahead of main, touching only DESCRIPTION, R/sysdata.rda and data-raw/harvest_report.md
    • main was not touched. It is still the merge commit of Parsers, harvest, catalog and the weekly workflow (#3, #4, #5, #6, #9) #19. That is the change this issue asked for over the original workflow, which pushed generated data straight to main

    What failed

    ##[error]GitHub Actions is not permitted to create or approve pull requests.
    

    The organisation does not allow Actions to open pull requests. The workflow declares pull-requests: write and the repository default is write, but the organisation switch overrides both.

    Fix, which needs an organisation owner: Settings, Actions, General, Workflow permissions, tick Allow GitHub Actions to create and approve pull requests. Then re-run the workflow; the branch it needs is already pushed.

    A note on the diff

    The run harvested the same data that was committed three hours earlier, so the expectation was "no changes". The branch is one commit ahead anyway, because the version bump and the harvest report changed. inst/extdata/ is absent from the diff, meaning the three CSVs are byte identical and the catalogue itself did not move. The change detection is behaving as designed: it bumps on a real difference in the generated files, not on a re-run alone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions