Skip to content

test submit

test submit #10

name: HubSubmissionValidationTesting(R)
on:
workflow_dispatch:
pull_request_target:
branches: main
paths:
- 'model-output/**'
- 'model-metadata/*'
- '!**README**'
jobs:
validate-submission:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
# Get changes from pull request for later use
# --------------------------------------------
- name: Get changes
id: get_changed_files
uses: tj-actions/changed-files@v36
# DEBUG ONLY
- name: List all changed files
run: |
for file in ${{ steps.get_changed_files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- uses: r-lib/actions/setup-r@v2
with:
install-r: false
use-public-rspm: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev libv8-dev
- uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: Infectious-Disease-Modeling-Hubs/hubValidations, any::sessioninfo
# - name: Install HubValidations
# run: |
# install.packages("remotes")
# remotes::install_github("Infectious-Disease-Modeling-Hubs/hubValidations")
# shell: Rscript {0}
- name: Run validations
env:
PR_NUMBER: ${{ github.event.number }}
run: |
library("hubValidations")
v <- hubValidations::validate_pr(
gh_repo = Sys.getenv("GITHUB_REPOSITORY"),
pr_number = Sys.getenv("PR_NUMBER"),
skip_submit_window_check = FALSE
)
hubValidations::check_for_errors(v, verbose = TRUE)
shell: Rscript {0}
# Eventually comment on it
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
All validation checks completed successfully.
pr_number: ${{ github.event.pull_request.number }}
# Approve pull request
# ---------------------------
- name: Approve Pull Request
uses: juliangruber/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
# Merge changes
# ---------------------------
# - uses: de-vri-es/setup-git-credentials@v2
# with:
# credentials: ${{ secrets.WF_PR_CREDENTIALS }}
- name: Merge the pull request
id: merge_pr
run: |
echo ">>> PR URL: ${{ github.event.pull_request.html_url }}"
gh pr merge --auto --squash $PR_URL
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ github.token }}
- name: Save changes to artifact
env:
changed_files: ${{ steps.get_changed_files.outputs.all_changed_files }}
run: |
echo "{ \"pr-changes\" : \"$changed_files\" }" > pr_changes.json
- name: Upload changes
uses: actions/upload-artifact@v2
with:
name: pr_changes
path: ./pr_changes.json