mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 14:42:04 +00:00
39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
name: ci
|
|
on: pull_request
|
|
|
|
jobs:
|
|
format_and_lint:
|
|
name: notebook format and lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.x'
|
|
- name: Fetch pull request branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Fetch base main branch
|
|
run: git fetch -u "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" main:main
|
|
- name: Install requirements
|
|
run: python3 -m pip install -U -r .github/workflows/linter/requirements.txt
|
|
- name: Format and lint notebooks
|
|
run: |
|
|
set +e
|
|
|
|
.github/workflows/linter/run_linter.sh -t
|
|
RTN=$?
|
|
|
|
if [ "$RTN" != "0" ]; then
|
|
echo "There were problems formatting/linting the notebooks."
|
|
echo "Please run the following commands locally from the root directory to attempt to autofix the issues:"
|
|
echo ""
|
|
echo "python3 -m pip install -U -r .github/workflows/linter/requirements.txt"
|
|
echo ".github/workflows/linter/run_linter.sh"
|
|
echo ""
|
|
echo "If it can't be autofixed, please fix them manually."
|
|
echo "Then, commit the fixes and push again."
|
|
exit 1
|
|
fi
|