build(deps-dev): bump requests from 2.30.0 to 2.31.0 #1
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: Python Checks | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
get_default_branch: | |
uses: ./.github/workflows/reusable-get-default-branch.yml | |
test: | |
runs-on: ubuntu-22.04 | |
needs: get_default_branch | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: Set up Python | |
uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[testing] | |
- name: Run type checker | |
id: type_check | |
continue-on-error: true | |
run: | | |
STDOUT=$(tox -e type-check) | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "stdout<<$EOF" >> "$GITHUB_OUTPUT" | |
echo "$STDOUT" >> "$GITHUB_OUTPUT" | |
echo "$EOF" >> "$GITHUB_OUTPUT" | |
- name: Run isort checker | |
id: isort_check | |
continue-on-error: true | |
run: tox -e isort-check | |
- name: Run format checker | |
id: format_check | |
continue-on-error: true | |
run: tox -e format-check | |
- name: Run linter | |
id: lint_check | |
continue-on-error: true | |
run: | | |
STDOUT=$(tox -e lint-check) | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "stdout<<$EOF" >> "$GITHUB_OUTPUT" | |
echo "$STDOUT" >> "$GITHUB_OUTPUT" | |
echo "$EOF" >> "$GITHUB_OUTPUT" | |
- name: Add PR comment | |
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | |
if: always() && github.event.pull_request.base.ref == needs.get_default_branch.outputs.default_branch && github.event_name == 'pull_request' | |
env: | |
WORKFLOW_RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
retries: 2 | |
script: | | |
const commentIdentifier = "Python Checks Results"; | |
const body = `#### ${commentIdentifier} | |
| Step | Status | | |
|------|--------| | |
| Type Check | ${{ steps.type_check.outcome }} | | |
| isort Check | ${{ steps.isort_check.outcome }} | | |
| Format Check | ${{ steps.format_check.outcome }} | | |
| Lint Check | ${{ steps.lint_check.outcome }} | | |
#### Type Checking Output | |
<details><summary>Output</summary> | |
\`\`\`\n | |
${{ steps.type_check.outputs.stdout }} | |
\`\`\` | |
</details> | |
#### Linter Output | |
<details><summary>Output</summary> | |
\`\`\`\n | |
${{ steps.lint_check.outputs.stdout }} | |
\`\`\` | |
</details> | |
*Actor: @${{ github.actor }}, Workflow Run URL: [${{ github.workflow }}](${{ env.WORKFLOW_RUN_URL }})* | |
`; | |
const issueComments = await github.rest.issues.listComments({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number | |
}); | |
const existingComment = issueComments.data.find(comment => comment.body.includes(commentIdentifier)); | |
if (existingComment) { | |
await github.rest.issues.updateComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: existingComment.id, | |
body, | |
}); | |
} else { | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body, | |
}); | |
} | |
- name: Fail job on any check failures | |
if: steps.type_check.outcome != 'success' || steps.isort_check.outcome != 'success' || steps.format_check.outcome != 'success' || steps.lint_check.outcome != 'success' | |
run: exit 1 |