better err mesage for environment flag with first push #3104
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: PR - pre-commit | |
on: | |
pull_request: | |
concurrency: | |
group: pr-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: ./.github/actions/setup-python/ | |
- run: poetry install | |
- run: poetry run pre-commit run --all-files | |
env: | |
SKIP: ruff | |
- run: | | |
poetry run ruff check . | |
poetry run ruff format . --check | |
test: | |
timeout-minutes: 30 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: ./.github/actions/setup-python/ | |
- run: poetry install | |
- name: run tests | |
run: poetry run pytest --durations=0 -m 'not integration' --junitxml=report.xml | |
- name: Publish Test Report # Not sure how to display this in the UI for non PRs. | |
uses: mikepenz/action-junit-report@v4 | |
if: always() | |
with: | |
commit: ${{github.event.workflow_run.head_sha}} # Doest that work outside PR? | |
report_paths: "report.xml" | |
markdown-link-check: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@master | |
- uses: gaurav-nelson/github-action-markdown-link-check@v1 | |
with: | |
use-verbose-mode: "yes" | |
folder-path: "docs" | |
enforce-chains-example-docs-sync: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
fetch-depth: 2 | |
- name: Fetch main branch | |
run: git fetch origin main | |
- name: Check if chains examples were modified | |
id: check_files | |
run: | | |
if git diff --name-only origin/main | grep -q '^truss-chains/examples/.*'; then | |
echo "chains_docs_update_needed=true" >> $GITHUB_ENV | |
echo "Chains examples were modified." | |
else | |
echo "chains_docs_update_needed=false" >> $GITHUB_ENV | |
echo "Chains examples were not modified." | |
echo "::notice file=truss-chains/examples/::Chains examples not modified." | |
fi | |
- name: Enforce acknowledgment in PR description | |
if: env.chains_docs_update_needed == 'true' | |
run: | | |
DESCRIPTION="${{ github.event.pull_request.body }}" | |
if [[ "$DESCRIPTION" != *"UPDATE_DOCS=done"* && "$DESCRIPTION" != *"UPDATE_DOCS=not_needed"* ]]; then | |
echo "::error file=truss-chains/examples/::Chains examples were modified and ack not found in PR description. Verify whether docs need to be update (https://github.com/basetenlabs/docs.baseten.co/tree/main/chains) and add an ack tag `UPDATE_DOCS={done|not_needed}` to the PR description." | |
exit 1 | |
else | |
echo "::notice file=truss-chains/examples/::Chains examples modified and ack found int PR description." | |
fi |