update-cdisc-data.yaml #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | |
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
| name: update-cdisc-data.yaml | |
| on: | |
| schedule: | |
| - cron: "0 6 * * 1" # Every Monday 06:00 UTC | |
| workflow_dispatch: | |
| inputs: | |
| force_update: | |
| description: "Force update even if no new versions detected" | |
| type: boolean | |
| default: false | |
| permissions: read-all | |
| jobs: | |
| update-data: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: any::xml2, any::usethis | |
| needs: website | |
| - name: Run data fetch scripts | |
| run: Rscript data-raw/fetch_all.R | |
| - name: Check for changes to data/ and inst/extdata/ | |
| id: changes | |
| run: | | |
| if git diff --quiet data/ inst/extdata/ data-raw/raw/; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| NEW=$(git diff --name-only data/ data-raw/raw/ | head -5 | tr '\n' ' ') | |
| echo "summary=Updated data files: $NEW" >> $GITHUB_OUTPUT | |
| fi | |
| shell: bash | |
| - name: Open Pull Request | |
| if: steps.changes.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: auto/cdisc-data-update | |
| commit-message: "data: automated CDISC data update" | |
| title: "Data update: ${{ steps.changes.outputs.summary }}" | |
| body: | | |
| ## Automated CDISC Data Update | |
| This PR was opened automatically after new CDISC data was detected. | |
| **Changes:** ${{ steps.changes.outputs.summary }} | |
| ### Review checklist | |
| - [ ] R CMD CHECK passes (runs automatically on this PR) | |
| - [ ] `cdiscdata_versions()` output looks correct | |
| - [ ] Spot-check SDTM CT: `get_ct("sdtm")` | |
| - [ ] Spot-check ADaM CT: `get_ct("adam")` | |
| - [ ] Update `NEWS.md` with new version(s) | |
| - [ ] Decide whether to trigger a CRAN submission after merge | |
| ### CRAN release decision | |
| - Patch bump (0.x.Y): routine quarterly CT update | |
| - Minor bump (0.X.0): new schema or stylesheet version | |
| labels: "automated,data-update" |