add a sample script to validate Metric Hub definitions #879
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: "Auto approve" | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
changed: | |
runs-on: ubuntu-latest | |
name: Get changed metric definition files | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files in the metrics definitions folder | |
id: changed-files-specific | |
uses: tj-actions/changed-files@v34 | |
with: | |
files: jetstream/defaults/*.toml | |
outputs: | |
any_changed: ${{ steps.changed-files-specific.outputs.any_changed }} | |
approve: | |
name: Leave a comment if defaults have been changed | |
permissions: | |
pull-requests: write | |
runs-on: ubuntu-latest | |
needs: changed | |
steps: | |
- uses: actions/github-script@v6 | |
if: needs.changed.outputs.any_changed == 'true' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: "⚠️ Changing default metrics will cause all experiments that are currently live to get rerun after this change has been merged. This may come with a substantial cost. To skip reruns, add `[ci skip-rerun]` to the PR message." | |
}) |