Skip to content
Closed
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
18 changes: 16 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,26 @@ updates:
interval: daily
time: "22:30"
timezone: "Europe/Berlin"
open-pull-requests-limit: 50
open-pull-requests-limit: 10
labels:
- dependencies
- github_actions
groups:
github-actions:
patterns:
- "*"

- package-ecosystem: pip
directory: /
schedule:
interval: daily
time: "22:30"
timezone: "Europe/Berlin"
open-pull-requests-limit: 50
open-pull-requests-limit: 10
labels:
- dependencies
- python
groups:
python-dependencies:
patterns:
- "*"
9 changes: 9 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@
- name: "Beta"
description: Beta Version Release
color: d73a4a
- name: dependencies
description: Dependency updates
color: 0366d6
- name: python
description: Python dependency updates
color: 3572A5
- name: github_actions
description: GitHub Actions dependency updates
color: 2088FF
35 changes: 35 additions & 0 deletions .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Auto-merge Dependabot

on:
pull_request_target:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:

permissions:
contents: write
pull-requests: write
Comment on lines +9 to +11

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Grant Actions permission for workflow update PRs

When the new Dependabot github-actions group opens a non-major update, the PR changes files under .github/workflows, but this job enables auto-merge with a GITHUB_TOKEN that only has contents and pull-requests permissions. The GitHub CLI auto-merge call fails in that scenario with the workflow-file permission error (same gh pr merge --auto --squash/permissions combination is documented in cli/cli#11493), so action-update PRs will never get auto-merge enabled unless this adds actions: write or excludes github-actions updates from this workflow.

Useful? React with 👍 / 👎.


jobs:
dependabot:
name: Enable auto-merge
if: github.actor == 'dependabot[bot]'

Check failure on line 16 in .github/workflows/auto-merge-dependabot.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Workflows should not rely on forgeable GitHub context values to trust events

See more on https://sonarcloud.io/project/issues?id=Ludy87_pyecotrend-ista&issues=AZ74TXxYkfrwfDy0Afgm&open=AZ74TXxYkfrwfDy0Afgm&pullRequest=667
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit

- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b # v2.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Enable auto-merge for safe updates
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr merge --auto --squash "$PR_URL"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
9 changes: 9 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
############################
# BUILDING THE DOCUMENTATION
Expand All @@ -36,6 +40,11 @@ jobs:
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
cache: pip
cache-dependency-path: |
pyproject.toml
requirements.txt
tox.ini

- name: Installing pip packages
run: |
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Pre-commit checks

on:
pull_request:
branches: [main]
merge_group:
types: [checks_requested]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
cache: pip
cache-dependency-path: .pre-commit-config.yaml

- name: Run pre-commit
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
with:
extra_args: --all-files --show-diff-on-failure
15 changes: 15 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -39,12 +43,23 @@ jobs:
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python_version }}
cache: pip
cache-dependency-path: |
pyproject.toml
tox.ini
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
- name: Run tests with tox
run: tox -e ${{ matrix.tox_env }}
- name: Upload coverage artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-${{ matrix.tox_env }}
path: coverage.xml
if-no-files-found: error

- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
Loading