From 16953d5993be6aad6c71a3a8acd1ba1465cef843 Mon Sep 17 00:00:00 2001 From: doublebyte Date: Sun, 18 Oct 2026 20:15:05 +0100 Subject: [PATCH 1/5] - added workflow for detecting AI --- .github/workflows/detect-ai.yml | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/detect-ai.yml diff --git a/.github/workflows/detect-ai.yml b/.github/workflows/detect-ai.yml new file mode 100644 index 000000000..9e2ec9a49 --- /dev/null +++ b/.github/workflows/detect-ai.yml @@ -0,0 +1,56 @@ +name: Detect AI +# Runs script to detect the likelihood of a PR have being create +# by an agent, or with a human with heavy use of AI. +on: + pull_request: + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + analyse: + name: Classify PR (AI vs human) + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CODEBERG_TOKEN: ${{ secrets.CODEBERG_TOKEN }} + steps: + - name: Check out repository + # The Codeberg repo is private, so we have to clone it with a Codeberg token + run: | + set -euo pipefail + [ -n "$CODEBERG_TOKEN" ] || { echo "::error::CODEBERG_TOKEN secret is required"; exit 1; } + clone_url="https://user:${CODEBERG_TOKEN}@codeberg.org/doublebyte/uncover-agent.git" + git clone --quiet "$clone_url" "$RUNNER_TEMP/uncover-agent" + shopt -s dotglob + mv "$RUNNER_TEMP/uncover-agent"/* . + rmdir "$RUNNER_TEMP/uncover-agent" + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" # we can change this later + + - name: Run uncover_agents.py + run: | + set -euo pipefail + PR_URL="https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}" + python uncover_agents.py "$PR_URL" | tee result.json + + - name: Apply AI / human label + run: | + set -euo pipefail + LABEL=$(python3 -c "import json;print(json.load(open('result.json')).get('label',''))") + echo "Classifier label: $LABEL" + case "$LABEL" in + Low) + gh pr edit "$PR_NUMBER" --add-label "human generated" ;; + High|Very\ High) + gh pr edit "$PR_NUMBER" --add-label "AI generated" ;; + *) + echo "Label '$LABEL' maps to no auto-label; nothing to do." ;; + esac + env: + PR_NUMBER: ${{ github.event.pull_request.number }} From ab3ecb42fe0eb82dd3c7dea32782ea3c136fe73c Mon Sep 17 00:00:00 2001 From: doublebyte Date: Sun, 18 Oct 2026 20:17:57 +0100 Subject: [PATCH 2/5] - put comments first --- .github/workflows/detect-ai.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/detect-ai.yml b/.github/workflows/detect-ai.yml index 9e2ec9a49..22b72f7cb 100644 --- a/.github/workflows/detect-ai.yml +++ b/.github/workflows/detect-ai.yml @@ -1,6 +1,8 @@ -name: Detect AI # Runs script to detect the likelihood of a PR have being create # by an agent, or with a human with heavy use of AI. + +name: Detect AI + on: pull_request: From d045bd55fa5e03c1147508d7065e81a7963ad4a1 Mon Sep 17 00:00:00 2001 From: doublebyte Date: Sun, 18 Oct 2026 20:23:05 +0100 Subject: [PATCH 3/5] - run this workflow on master and detect-ai branches --- .github/workflows/detect-ai.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/detect-ai.yml b/.github/workflows/detect-ai.yml index 22b72f7cb..5213abda8 100644 --- a/.github/workflows/detect-ai.yml +++ b/.github/workflows/detect-ai.yml @@ -5,7 +5,10 @@ name: Detect AI on: pull_request: - + branches: + - master + - detect-ai + permissions: contents: read pull-requests: write From df7f97a35d81421ab2246263ff7acca09694435d Mon Sep 17 00:00:00 2001 From: doublebyte Date: Sun, 18 Oct 2026 20:23:44 +0100 Subject: [PATCH 4/5] - run this pr on master and uncover-agent branch --- .github/workflows/detect-ai.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/detect-ai.yml b/.github/workflows/detect-ai.yml index 5213abda8..6b0ef913c 100644 --- a/.github/workflows/detect-ai.yml +++ b/.github/workflows/detect-ai.yml @@ -7,8 +7,8 @@ on: pull_request: branches: - master - - detect-ai - + - uncover-agent + permissions: contents: read pull-requests: write From 16d16d24b7d772bb3e18a3d4c3d820e22ef3e1a0 Mon Sep 17 00:00:00 2001 From: Jo Date: Sun, 18 Oct 2026 20:54:27 +0100 Subject: [PATCH 5/5] uncover-agent: test diff marker --- .uncover-agent/NOTE.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .uncover-agent/NOTE.txt diff --git a/.uncover-agent/NOTE.txt b/.uncover-agent/NOTE.txt new file mode 100644 index 000000000..8c1c91ee0 --- /dev/null +++ b/.uncover-agent/NOTE.txt @@ -0,0 +1,4 @@ +# uncover-agent test diff +# original: https://github.com/geopython/diving-into-pygeoapi/pull/246 +# kind=human +# generated 2026-10-18 19:54:27 UTC