Skip to content

ci(dependabot): prevent python version drift & auto-orchestrate updates#5

Merged
gildesmarais merged 4 commits intomainfrom
chore/dependabot
May 1, 2026
Merged

ci(dependabot): prevent python version drift & auto-orchestrate updates#5
gildesmarais merged 4 commits intomainfrom
chore/dependabot

Conversation

@gildesmarais
Copy link
Copy Markdown
Member

@gildesmarais gildesmarais commented May 1, 2026

This pull request updates the repository's dependency management and CI workflows to improve automation and keep dependencies more up-to-date. The main changes include configuring Dependabot to check for updates more frequently, increasing the number of open PRs, grouping dependency updates differently, and introducing automatic merging of Dependabot PRs. Additionally, the CI workflow now dynamically sets the Python version based on the Dockerfile.

Dependabot configuration improvements:

  • Changed the update schedule for pip, github-actions, and docker dependencies in .github/dependabot.yml from monthly to weekly (Mondays at 05:00), increased the open pull request limit from 1 to 10, switched the branch merge strategy to "rebase", and renamed dependency groups for clarity. [1] [2] [3]

Automation enhancements:

  • Added a new workflow .github/workflows/dependabot-automerge.yml to automatically enable auto-merge for Dependabot pull requests, streamlining dependency updates.

Continuous Integration (CI) improvements:

  • Updated .github/workflows/ci.yml to dynamically extract the Python version from the Dockerfile and use it when setting up Python, ensuring consistency between the CI environment and the Docker image.

Implement dynamic python-version extraction in CI workflow by parsing
the Dockerfile FROM instruction. This ensures the unit test environment
always matches the container runtime without manual intervention.
Add a dedicated workflow to enable GitHub's native auto-merge feature
for Dependabot PRs. This allows dependencies that pass CI to be
merged automatically, reducing manual maintenance overhead.
Align all Dependabot ecosystems (pip, docker, actions) to trigger
weekly on Mondays at 05:00 UTC. Enable update grouping and rebase
strategy to minimize PR noise and ensure a streamlined update cycle.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates dependency automation and CI so the repo’s dependency updates are more frequent/automated and CI’s Python version stays consistent with the Docker image.

Changes:

  • Adjust Dependabot to run weekly with higher PR limits and updated grouping.
  • Add a workflow to enable auto-merge on Dependabot PRs.
  • Update CI to extract the Python version from Dockerfile and use it for setup-python.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
.github/dependabot.yml Moves Dependabot schedules to weekly and updates grouping/limits for faster dependency upkeep.
.github/workflows/dependabot-automerge.yml Introduces auto-merge enablement for Dependabot PRs via GitHub CLI.
.github/workflows/ci.yml Derives Python version from Dockerfile to prevent CI/image version drift.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
id: get-version
run: |
# Extract version like "3.14" from "FROM python:3.14-slim..."
VERSION=$(grep -m 1 "^FROM python:" Dockerfile | sed -E 's/^FROM python:([0-9]+\.[0-9]+).*/\1/')
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfile parsing step can produce an empty VERSION (e.g., if the FROM python: line changes format), which then causes a confusing failure later in setup-python. Add an explicit validation that VERSION is non-empty (and ideally print a clear error and exit non-zero) before writing to $GITHUB_OUTPUT.

Suggested change
VERSION=$(grep -m 1 "^FROM python:" Dockerfile | sed -E 's/^FROM python:([0-9]+\.[0-9]+).*/\1/')
VERSION=$(grep -m 1 "^FROM python:" Dockerfile | sed -E 's/^FROM python:([0-9]+\.[0-9]+).*/\1/')
if [ -z "$VERSION" ]; then
echo "Error: Failed to extract Python version from Dockerfile. Expected a line like 'FROM python:<major>.<minor>-...'" >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml Outdated
Comment on lines +16 to +17
outputs:
python-version: ${{ steps.get-version.outputs.version }}
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit-tests.outputs.python-version is defined but not consumed by any downstream job/workflow. If nothing uses this output, consider removing it to avoid confusion (or add a consumer via needs.unit-tests.outputs.python-version).

Suggested change
outputs:
python-version: ${{ steps.get-version.outputs.version }}

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +6
on: pull_request

permissions:
contents: write
pull-requests: write
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow uses on: pull_request, but Dependabot-triggered workflows commonly receive a read-only GITHUB_TOKEN on pull_request, which will prevent gh pr merge --auto ... from enabling auto-merge/merging. Consider switching to pull_request_target (and keep the strict dependabot[bot] guard and avoid checking out PR code) so the token can have the write permissions you’ve declared.

Copilot uses AI. Check for mistakes.
- Add validation to Python version extraction in ci.yml
- Remove unused python-version job output in ci.yml
- Switch automerge trigger to pull_request_target for write permissions
@gildesmarais gildesmarais changed the title ci(dependabot): prevent python version drift & orchestrate updates ci(dependabot): prevent python version drift & auto-orchestrate updates May 1, 2026
@gildesmarais gildesmarais merged commit a09cdc3 into main May 1, 2026
5 checks passed
@gildesmarais gildesmarais deleted the chore/dependabot branch May 1, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants