-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh: add comment trigger for baseline_updates
- Loading branch information
Showing
3 changed files
with
20 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# .github/workflows/regression_tests.yml | ||
name: Update Regression Tests | ||
name: Update Regression Baseline | ||
|
||
on: | ||
workflow_dispatch: | ||
issue_comment: | ||
types: [created] | ||
|
||
|
||
jobs: | ||
regression_tests: | ||
name: regression_tests | ||
if: github.event.issue.pull_request && contains(github.event.comment.body, '/update_baseline') | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
contents: write | ||
|
@@ -27,6 +30,15 @@ jobs: | |
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e ".[dev]" | ||
- name: Get PR branch | ||
uses: xt0rted/pull-request-comment-branch@v1 | ||
id: comment-branch | ||
|
||
- name: Checkout PR branch | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ steps.comment-branch.outputs.head_ref }} | ||
|
||
- name: Update baseline | ||
if: github.event.pull_request.base.ref == 'main' | ||
|
@@ -35,13 +47,9 @@ jobs: | |
git config --global user.email '[email protected]' | ||
NEW_BASELINE=1 pytest -m regression | ||
- name: Commit and push if baseline changed | ||
- name: Commit and push | ||
if: github.event.pull_request.base.ref == 'main' | ||
run: | | ||
if git diff --quiet tests/regression_test_baselines.json; then | ||
echo "No changes to baseline file" | ||
else | ||
git add tests/regression_test_baselines.json | ||
git commit -m "Update regression test baselines" | ||
git push origin HEAD:${{ github.head_ref }} | ||
fi | ||
git add tests/regression_test_baselines.json | ||
git commit -m "Update regression test baselines" | ||
git push origin HEAD:${{ steps.comment-branch.outputs.head_ref }} |
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