diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index 8037c87d8..015fb0300 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: - ref: ${{ github.event.pull_request.head.sha }} + ref: ${{ github.event.workflow_run.head.sha }} - name: Install Python 3.12 uses: actions/setup-python@v5 with: @@ -49,9 +49,10 @@ jobs: run: echo "## Model Benchmark" >> report.md - name: Write Benchmark Report run: poetry run python tests/metrics/compareMetrics.py >> report.md - - name: Publish Report with CML + - name: Update report.md plots with CML env: REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HEAD_SHA: ${{ github.event.workflow_run.head_sha }} run: | echo "
\nModel training plots\n" >> report.md echo "## Model Training" >> report.md @@ -64,7 +65,16 @@ jobs: echo "### EnergyPriceDaily" >> report.md cml asset publish tests/metrics/EnergyPriceDaily.svg --md >> report.md echo "\n
" >> report.md - cml comment update --target=pr report.md # Post reports as comments in GitHub PRs + - name: Post comment to PR with CML + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HEAD_SHA: ${{ github.event.workflow_run.head_sha }} + run: | + echo + echo $GITHUB_SHA + echo ${{ github.event.pull_request.head.sha }} + echo $GITHUB_REPOSITORY_OWNER + cml comment update --target=pr report.md # post to PR # --target=pr/${{ github.event.pull_request.head.sha }} --repo=${{ github.event.pull_request.head.repo.html_url }} cml check create --title=ModelReport report.md # update status of check in PR - name: Upload metrics if on main uses: actions/upload-artifact@v3