Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to produce a report from validate_hub_config() and view_config_val_errors() on CI #31

Closed
zkamvar opened this issue Aug 6, 2024 · 0 comments · Fixed by #37

Comments

@zkamvar
Copy link
Member

zkamvar commented Aug 6, 2024

This originally stems from hubverse-org/hubverse-actions#9 where I and @annakrystalli implemented a fix in hubverse-org/hubverse-actions#20 that involves more than 20 lines of R code inside a GitHub workflow.

Given that these lines of code are exclusive to the domain of R and this package, it would make more sense for a function to be written from these lines of code.

The function should do the following:

  1. Take in a vector of hubs and a path to an output file
  2. for each hub:
    i. run validate_hub_config() and, if necessary, view_config_val_errors()
    ii. append a report to the output file
    iii. return github error on failure
  3. return TRUE if all configuration files are valid

This way, we would be able to reduce the maintenance burden on the validate-hub-config workflow files, which is especially important given that they are distributed and not centrally controlled (and fixing bugs in this context is not easy: https://github.com/zkamvar/2022-10-20-workflow-bug).

From here, the workflow could look something like this after this is implemented:

      - name: Run validations
        id: validate
        run: |
          hub_path <- Sys.getenv("HUB_PATH")
          diff <- file.path(hub_path, "diff.md")
          hubAdmin::ci_validate_hub_config(hub_path, diff)
        shell: Rscript {0}
      - name: "Comment on PR"
        id: comment-diff
        if: ${{ always() && github.event_name != 'workflow_dispatch' }}
        uses: carpentries/actions/comment-diff@main
        with:
          pr: ${{ env.PR_NUMBER }}
          path: ${{ env.HUB_PATH }}/diff.md
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 a pull request may close this issue.

1 participant