Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ updates:
prefix: "build(uv)"
labels:
- "dependencies:requirements"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]

- package-ecosystem: "github-actions"
directories:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/ci_cd_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,58 @@ jobs:
git commit -am "fix: update requirements files [skip ci]"
fi
git push

append-pr-note:
name: Append pyproject.toml note to dependabot PR
permissions:
contents: read
pull-requests: write # Needed to edit the dependabot PR body
runs-on: ubuntu-latest
steps:
- name: "Append warning note to the dependabot PR body"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
BRANCH: ${{ github.ref_name }}
run: |
set -euo pipefail

# Resolve the PR number associated with the pushed dependabot branch.
PR_NUMBER="$(gh pr list --head "${BRANCH}" --state open --json number -q '.[0].number' || true)"
if [ -z "${PR_NUMBER}" ]; then
echo "::warning::No open PR found for branch '${BRANCH}' yet; skipping PR body update."
exit 0
fi
echo "Found PR #${PR_NUMBER} for branch '${BRANCH}'."

# Hidden marker to prevent duplicate appends.
MARKER="<!-- ansys-actions:pyproject-note -->"

# Fetch the current PR body.
CURRENT_BODY="$(gh pr view "${PR_NUMBER}" --json body -q .body)"

if printf '%s' "${CURRENT_BODY}" | grep -qF "${MARKER}"; then
echo "Marker already present in PR #${PR_NUMBER} body; nothing to do."
exit 0
fi

# Build the new body: existing body + blank line + marked note block.
NEW_BODY_FILE="$(mktemp)"
{
printf '%s\n\n' "${CURRENT_BODY}"
printf '%s\n' "${MARKER}"
cat <<'EOF'
> [!WARNING]
> If this dependabot update includes any changes to the `pyproject.toml`, ensure the version specifiers in the `pyproject.toml` are reverted to a valid `major.minor` range by taking the following steps:
> - Clone the branch locally.
> - Update the pinned versions in the `pyproject.toml` as needed. For example, say dependabot proposes a change from "wcwidth<=0.7" to "wcwidth<=0.8.1", this must be updated to "wcwidth<=0.9". Another example is a change from "safety>=3.7,<4" to "safety>=3.8.0,<4", this must be updated to "safety>=3.8,<4". No changes should be made to the `requirement.txt` files.
Comment thread
moe-ad marked this conversation as resolved.
Outdated
> - Run `uv lock` to update the lock file.
> - Commit your changes to the PR and proceed to merge.
Comment thread
moe-ad marked this conversation as resolved.
Outdated
EOF
printf '%s\n' "<!-- /ansys-actions:pyproject-note -->"
} > "${NEW_BODY_FILE}"

# Update the PR body using --body-file to avoid shell escaping issues
# with backticks, angle brackets, and quoted version specifiers.
gh pr edit "${PR_NUMBER}" --body-file "${NEW_BODY_FILE}"
echo "Appended pyproject.toml warning note to PR #${PR_NUMBER}."
1 change: 1 addition & 0 deletions doc/source/changelog/1425.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update the handling of uv dependabot updates
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ check-licenses = [
]
check-vulnerabilities = [
"bandit>=1.9,<2",
"click>=8.4.1,<9",
"click>=8.4,<9",
"pygithub>=2.9,<3",
"safety>=3.8.1,<4",
"safety>=3.8,<4",
]
code-style-pre-commit = [
"pre-commit<=4.6",
Expand All @@ -51,13 +51,13 @@ doc-style = [
"tomlkit<=0.15",
]
hk-package-clean-except = [
"fastcore<=1.14.5",
"ghapi<=2.0.1",
"fastcore<=1.15",
"ghapi<=2.1",
"packaging<=26.2",
]
hk-package-clean-untagged = [
"fastcore<=1.14.5",
"ghapi<=2.0.1",
"fastcore<=1.15",
"ghapi<=2.1",
"packaging<=26.2",
]
release-github = [
Expand Down
12 changes: 6 additions & 6 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading