Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/chainguard/update-uv-lock.sts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
issuer: https://token.actions.githubusercontent.com
subject_pattern: "repo:github-community-projects/pr-conflict-detector:pull_request"
claim_pattern:
job_workflow_ref: "github-community-projects/pr-conflict-detector/.github/workflows/update-uv-lock.yml@.*"

permissions:
contents: write
13 changes: 8 additions & 5 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ jobs:
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
with:
python-version: 3.14
version: "0.10.9"
enable-cache: true

- name: Set up Python
run: uv python install 3.14

- name: Install dependencies
run: |
pip install -r requirements.txt -r requirements-test.txt
run: uv sync --frozen --python 3.14
11 changes: 7 additions & 4 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ jobs:
# list of changed files within `super-linter`
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
with:
python-version: "3.14"
version: "0.10.9"
enable-cache: true
- name: Set up Python
run: uv python install 3.14
- name: Install dependencies
run: |
pip install -r requirements.txt -r requirements-test.txt
run: uv sync --frozen
- name: Lint Code Base
uses: super-linter/super-linter@61abc07d755095a68f4987d1c2c3d1d64408f1f9 # v8.5.0
env:
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ jobs:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
with:
python-version: ${{ matrix.python-version }}
version: "0.10.9"
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt -r requirements-test.txt
run: uv sync --frozen --python ${{ matrix.python-version }}
- name: Lint with flake8 and pylint
run: |
make lint
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/update-uv-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Update uv.lock

on:
pull_request:
paths:
- pyproject.toml

permissions:
id-token: write

jobs:
update-lock:
if: github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Get GitHub App token via octo-sts
uses: octo-sts/action@f603d3be9d8dd9871a265776e625a27b00effe05 # v1.1.1
id: octo-sts
with:
scope: github-community-projects/pr-conflict-detector
identity: update-uv-lock

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.head_ref }}
persist-credentials: true
token: ${{ steps.octo-sts.outputs.token }}

- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
with:
version: "0.10.9"
enable-cache: true

- name: Update uv.lock
run: uv lock

- name: Commit and push updated lockfile
run: |
git config user.name "octo-sts[bot]"
git config user.email "801323+octo-sts[bot]@users.noreply.github.com"
git add uv.lock
git diff --cached --quiet || git commit -s -m "chore(deps): update uv.lock"
git push
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ coverage.xml
.vscode/
.DS_Store
venv/
**/.claude/*.local.*

pr_conflict_report.json
pr_conflict_report.md
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
FROM python:3.14.3-slim@sha256:6a27522252aef8432841f224d9baaa6e9fce07b07584154fa0b9a96603af7456
LABEL org.opencontainers.image.source https://github.com/github-community-projects/pr-conflict-detector

COPY --from=ghcr.io/astral-sh/uv:0.10.9@sha256:10902f58a1606787602f303954cea099626a4adb02acbac4c69920fe9d278f82 /uv /uvx /bin/

WORKDIR /action/workspace
COPY requirements.txt *.py /action/workspace/
COPY pyproject.toml uv.lock *.py /action/workspace/

RUN python3 -m pip install --no-cache-dir --no-deps -r requirements.txt \
RUN uv sync --frozen --no-dev --no-editable \
&& apt-get -y update \
&& apt-get -y install --no-install-recommends git=1:2.47.3-0+deb13u1 \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -16,5 +18,6 @@ RUN python3 -m pip install --no-cache-dir --no-deps -r requirements.txt \
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD python3 -c "import os,sys; sys.exit(0 if os.path.exists('/action/workspace/pr_conflict_detector.py') else 1)"

ENV PYTHONUNBUFFERED=1
CMD ["/action/workspace/pr_conflict_detector.py"]
ENTRYPOINT ["python3", "-u"]
ENTRYPOINT ["uv", "run"]
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: test
test:
pytest -v --cov=. --cov-config=.coveragerc --cov-fail-under=80 --cov-report term-missing
uv run pytest -v --cov=. --cov-config=.coveragerc --cov-fail-under=80 --cov-report term-missing

.PHONY: clean
clean:
Expand All @@ -9,10 +9,10 @@ clean:
.PHONY: lint
lint:
# stop the build if there are Python syntax errors or undefined names
flake8 . --config=.github/linters/.flake8 --count --select=E9,F63,F7,F82 --show-source
uv run flake8 . --config=.github/linters/.flake8 --count --select=E9,F63,F7,F82 --show-source
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --config=.github/linters/.flake8 --count --exit-zero --max-complexity=15 --max-line-length=150
isort --settings-file=.github/linters/.isort.cfg .
pylint --rcfile=.github/linters/.python-lint --fail-under=9.0 *.py
mypy --config-file=.github/linters/.mypy.ini *.py
black .
uv run flake8 . --config=.github/linters/.flake8 --count --exit-zero --max-complexity=15 --max-line-length=150
uv run isort --settings-file=.github/linters/.isort.cfg .
uv run pylint --rcfile=.github/linters/.python-lint --fail-under=9.0 *.py
uv run mypy --config-file=.github/linters/.mypy.ini *.py
uv run black .
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,19 +407,15 @@ env:
git clone https://github.com/github-community-projects/pr-conflict-detector.git
cd pr-conflict-detector

# Set up a virtual environment
python3 -m venv venv
source venv/bin/activate

# Set up environment
cp .env-example .env
# Edit .env with your configuration

# Install dependencies
pip install -r requirements.txt -r requirements-test.txt
uv sync

# Run locally
python3 pr_conflict_detector.py
uv run pr_conflict_detector.py

# Run tests
make test
Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[project]
name = "pr-conflict-detector"
version = "1.0.0"
description = "Detect pull request conflicts and notify"
requires-python = ">=3.11"
dependencies = [
"cryptography==46.0.5",
"github3-py==4.0.1",
"pyjwt==2.11.0",
"python-dotenv==1.2.2",
"requests==2.32.5",
]

[dependency-groups]
dev = [
"black==26.1.0",
"flake8==7.3.0",
"mypy==1.19.1",
"pylint==4.0.5",
"pytest==9.0.2",
"pytest-cov==7.0.0",
"types-requests==2.32.4.20260107",
]
7 changes: 0 additions & 7 deletions requirements-test.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

Loading
Loading