BranchWrite
is useful for storing report data generated by GatorGrade
into a repository branch. GatorGrade
always creates an environment variable JSON_REPORT
while GatorGrade
runs the report with env no matter with the report format (e.g. cmd gatorgrade --config config/gatorgrade.yml --report env md GITHUB_STEP_SUMMARY
still generates a JSON_REPORT
env though md is the desired format)
BranchWrite
always overrides the destination file. To make multiple reports, please make file names unique. One of the ways to achieve so is by using Get-Current-Time action to dynamically generate an unique time suffix for file names.
- name: Get current time
uses: josStorer/get-current-time@v2
if: always()
id: current-time
with:
format: YYYYMMDD-HH
utcOffset: "+08:00"
- name: write branch
uses: GatorEducator/BranchWrite@v1.0.1
if: always()
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
branch: insight
path: insight/hello-action-${{steps.current-time.outputs.formattedTime}}.json
source: env
source-arg: JSON_REPORT
while GatorGrade
throws any failing check, the whole step of GatorGrade
in the workflow file will fail and the following steps behind GatorGrade
will be aborted by GitHub. To keep BranchWrite
running, add if: always
flag for BranchWrite
- name: Run GatorGrader with GatorGrade
run: |
pipx install gatorgrade
gatorgrade --config config/gatorgrade.yml --report env md GITHUB_STEP_SUMMARY
- name: write branch
uses: GatorEducator/BranchWrite@v1.0.1
if:
always()
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
branch: insight
path: insight/hello-action.json
source: env
source-arg: JSON_REPORT