Example to use polytope & Array #168
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
# run pre-commit | |
name: lint | |
on: | |
pull_request: | |
jobs: | |
lint: | |
permissions: | |
contents: read | |
pull-requests: write | |
runs-on: "ubuntu-22.04" | |
defaults: | |
run: | |
shell: /usr/bin/bash -o pipefail -u -e {0} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: install pre-commit | |
run: pip install pre-commit | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: setup pre-commit | |
run: | | |
pre-commit install-hooks | |
- name: run pre-commit | |
run: | | |
pre-commit run --color=always --from-ref '${{ github.event.pull_request.base.sha }}' --to-ref '${{ github.event.pull_request.head.sha }}' 2>&1 | tee pre-commit-output | |
- name: pre-commit tip | |
if: failure() | |
run: | | |
echo 'run `pre-commit run --all-files` and commit the resulting changes' | |
- name: render report (click Summary to view) | |
if: failure() | |
run: | | |
cat <<EOF >> report | |
## pre-commit failed | |
Run \`pre-commit run --all-files\` to check for errors. | |
Usually, these will just be auto-formatting changes, | |
which you can commit and push. | |
You can install the pre-commit hooks with: | |
\`\`\` | |
pip install pre-commit | |
pre-commit install | |
\`\`\` | |
pre-commit output: | |
\`\`\`\` | |
$(cat pre-commit-output | sed 's/\x1b\[[0-9;?]*[mh]//g') | |
\`\`\`\` | |
<details> | |
<summary>diff produced by auto-formatters:</summary> | |
\`\`\`diff | |
$(git diff HEAD) | |
\`\`\` | |
</details> | |
EOF | |
cat report | |
cat report >> $GITHUB_STEP_SUMMARY |