feat: dispatch validation with low stats for PRs or high stats for PR merges #75
Workflow file for this run
This file contains 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
name: Dispatch Validation | |
on: | |
pull_request: | |
push: | |
branches: [ development ] | |
tags: [ '*' ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
# number of events; use 0 for the default in `clas12-validation` | |
num_events_low_stats: 0 | |
num_events_high_stats: 10000 | |
jobs: | |
clas12-validation: | |
name: clas12-validation dispatch | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push' }} # not a PR from a fork || is a push | |
steps: | |
- name: sanitize message | |
id: sanitize | |
run: echo title=$(echo '${{ github.event.pull_request.title || github.event.head_commit.message }}' | head -n1 | sed 's;";;g' | sed "s;';;g") >> $GITHUB_OUTPUT | |
- name: set number of events | |
id: num_events | |
run: | | |
# use low stats for PR commits, or high stats for pushes (which should only be PR merges) | |
[ "${{ github.event_name }}" = "push" ] && num_events=${{ env.num_events_high_stats }} || num_events=${{ env.num_events_low_stats }} | |
echo num_events=$num_events >> $GITHUB_OUTPUT | |
- name: dispatch | |
uses: c-dilks/trigger-workflow-and-wait@master # convictional/[email protected] | |
with: | |
owner: JeffersonLab | |
repo: clas12-validation | |
summarize: true | |
github_token: ${{ secrets.CLAS12VALIDATION }} | |
workflow_file_name: ci.yml | |
ref: main | |
client_payload: >- | |
{ | |
"num_events": "${{ steps.num_events.outputs.num_events }}", | |
"actor": "${{ github.actor }}", | |
"source": "${{ github.event.repository.name }}", | |
"title": "${{ steps.sanitize.outputs.title }}", | |
"source_url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}", | |
"git_coatjava": "{\"fork\": \"${{ github.repository }}\", \"branch\": \"${{ github.head_ref || github.ref_name }}\" }" | |
} |