mirror of
https://github.com/mandiant/capa.git
synced 2026-06-22 14:51:56 -07:00
7b23834d8e
* build(deps-dev): bump black from 25.12.0 to 26.3.0 Bumps [black](https://github.com/psf/black) from 25.12.0 to 26.3.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/25.12.0...26.3.0) --- updated-dependencies: - dependency-name: black dependency-version: 26.3.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * style: auto-format with black and isort --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Moritz <mr-tz@users.noreply.github.com> Co-authored-by: Capa Bot <capa-dev@mandiant.com>
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: black auto-format
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ master ]
|
|
paths-ignore:
|
|
- 'web/**'
|
|
- 'doc/**'
|
|
- '**.md'
|
|
workflow_dispatch: # allow manual trigger
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
black-format:
|
|
# only run on dependabot PRs or manual trigger
|
|
if: github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch'
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
with:
|
|
ref: ${{ github.head_ref }}
|
|
# need a token with write access to push the commit
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Python 3.13
|
|
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -r requirements.txt
|
|
pip install -e .[dev,scripts]
|
|
|
|
- name: Run isort
|
|
run: pre-commit run isort --all-files
|
|
|
|
- name: Run black/continue
|
|
# black returns non-zero error code after formatting, which is what we expect
|
|
continue-on-error: true
|
|
run: pre-commit run black --all-files
|
|
|
|
- name: Check for changes
|
|
id: changes
|
|
run: |
|
|
if git diff --quiet; then
|
|
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Commit and push formatting changes
|
|
if: steps.changes.outputs.has_changes == 'true'
|
|
run: |
|
|
git config user.name "${GITHUB_ACTOR}"
|
|
git config user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
|
|
git add -A
|
|
git commit -m "style: auto-format with black and isort"
|
|
git push
|