Skip to content

Commit 7fda6a1

Browse files
committed
fix: resolve remaining pre-commit hook quality issues
- Fix final f-string placeholder issue in test_auto_release.py - Remove unused python_path variable in test_integration.py - Add type ignore comments for requests and yaml imports in diagnose_permissions.py - Fix remaining markdown line length violations in documentation files - Ensure all pre-commit hooks pass completely for clean development workflow
1 parent 314a928 commit 7fda6a1

30 files changed

+609
-520
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*.rs text eol=lf
66
*.toml text eol=lf
77

8-
# Python source files should always use LF line endings
8+
# Python source files should always use LF line endings
99
*.py text eol=lf
1010

1111
# YAML files should always use LF line endings

.github/workflows/auto-release-with-pat.yml.example

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Alternative Automated Release Pipeline using Personal Access Token
2-
#
2+
#
33
# This is an example workflow that uses a Personal Access Token instead of GITHUB_TOKEN
44
# Use this if the main workflow fails due to permission issues that can't be resolved
55
# with repository settings.
@@ -39,60 +39,60 @@ jobs:
3939
version_type: ${{ steps.version_check.outputs.version_type }}
4040
new_version: ${{ steps.version_check.outputs.new_version }}
4141
current_version: ${{ steps.version_check.outputs.current_version }}
42-
42+
4343
steps:
4444
- uses: actions/checkout@v4
4545
with:
4646
fetch-depth: 0
4747
# Use Personal Access Token instead of GITHUB_TOKEN
4848
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
4949
persist-credentials: true
50-
50+
5151
- name: Set up Python
5252
uses: actions/setup-python@v5
5353
with:
5454
python-version: ${{ env.PYTHON_VERSION }}
55-
55+
5656
- name: Configure Git with PAT
5757
run: |
5858
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
5959
git config --local user.name "github-actions[bot]"
6060
# Configure git to use the Personal Access Token
6161
git config --local url."https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/".insteadOf "https://github.com/"
62-
62+
6363
- name: Set up Rust
6464
uses: dtolnay/rust-toolchain@stable
6565
with:
6666
components: rustfmt, clippy
67-
67+
6868
- name: Check Rust formatting
6969
run: cargo fmt --all -- --check
70-
70+
7171
- name: Run Rust linting
7272
run: cargo clippy --all-targets --all-features -- -D warnings
73-
73+
7474
- name: Analyze commits and determine version bump
7575
id: version_check
7676
run: |
7777
# Get current version
7878
CURRENT_VERSION=$(python scripts/get_version.py)
7979
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
8080
echo "Current version: $CURRENT_VERSION"
81-
81+
8282
# Get commits since last tag
8383
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
8484
if [ -z "$LAST_TAG" ]; then
8585
COMMITS=$(git log --oneline)
8686
else
8787
COMMITS=$(git log ${LAST_TAG}..HEAD --oneline)
8888
fi
89-
89+
9090
echo "Analyzing commits since $LAST_TAG:"
9191
echo "$COMMITS"
92-
92+
9393
# Determine version bump type based on commit messages
9494
VERSION_TYPE="none"
95-
95+
9696
# Check for breaking changes (major version)
9797
if echo "$COMMITS" | grep -qiE "(BREAKING CHANGE|breaking:|major:)"; then
9898
VERSION_TYPE="major"
@@ -103,7 +103,7 @@ jobs:
103103
elif echo "$COMMITS" | grep -qiE "(fix:|patch:|chore:|docs:|style:|refactor:|perf:|test:)"; then
104104
VERSION_TYPE="patch"
105105
fi
106-
106+
107107
# Skip release if no relevant changes
108108
if [ "$VERSION_TYPE" = "none" ]; then
109109
echo "No version-relevant changes detected. Skipping release."
@@ -112,17 +112,17 @@ jobs:
112112
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
113113
exit 0
114114
fi
115-
115+
116116
echo "Determined version bump type: $VERSION_TYPE"
117117
echo "should_release=true" >> $GITHUB_OUTPUT
118118
echo "version_type=$VERSION_TYPE" >> $GITHUB_OUTPUT
119-
119+
120120
# Calculate new version
121121
python scripts/bump_version.py $VERSION_TYPE
122122
NEW_VERSION=$(python scripts/get_version.py)
123123
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
124124
echo "New version will be: $NEW_VERSION"
125-
125+
126126
- name: Commit version changes
127127
if: steps.version_check.outputs.should_release == 'true'
128128
run: |
@@ -133,7 +133,7 @@ jobs:
133133
echo "Committing version changes..."
134134
git add -A
135135
git commit -m "chore: bump version to ${{ steps.version_check.outputs.new_version }} [skip ci]"
136-
136+
137137
# Push with retry logic using PAT
138138
for i in {1..3}; do
139139
if git push origin main; then
@@ -143,28 +143,28 @@ jobs:
143143
echo "❌ Push attempt $i failed, retrying in 5 seconds..."
144144
sleep 5
145145
fi
146-
146+
147147
if [ $i -eq 3 ]; then
148148
echo "❌ Failed to push after 3 attempts"
149149
echo "Token permissions: ${{ secrets.PERSONAL_ACCESS_TOKEN && 'PAT configured' || 'PAT missing' }}"
150150
exit 1
151151
fi
152152
done
153153
fi
154-
154+
155155
- name: Create and push tag
156156
if: steps.version_check.outputs.should_release == 'true'
157157
run: |
158158
TAG_NAME="v${{ steps.version_check.outputs.new_version }}"
159159
echo "Creating tag: $TAG_NAME"
160-
160+
161161
# Check if tag already exists
162162
if git tag -l | grep -q "^$TAG_NAME$"; then
163163
echo "⚠️ Tag $TAG_NAME already exists, skipping tag creation"
164164
else
165165
git tag "$TAG_NAME"
166166
echo "✅ Created tag: $TAG_NAME"
167-
167+
168168
# Push tag with retry logic using PAT
169169
for i in {1..3}; do
170170
if git push origin "$TAG_NAME"; then
@@ -174,7 +174,7 @@ jobs:
174174
echo "❌ Tag push attempt $i failed, retrying in 5 seconds..."
175175
sleep 5
176176
fi
177-
177+
178178
if [ $i -eq 3 ]; then
179179
echo "❌ Failed to push tag after 3 attempts"
180180
exit 1
@@ -184,21 +184,21 @@ jobs:
184184

185185
# Rest of the workflow remains the same as the main auto-release.yml
186186
# (build-and-release, build-sdist, publish, create-release jobs)
187-
187+
188188
build-and-release:
189189
needs: analyze-and-version
190190
if: needs.analyze-and-version.outputs.should_release == 'true'
191191
runs-on: ${{ matrix.os }}
192192
strategy:
193193
matrix:
194194
os: [ubuntu-latest, windows-latest, macos-latest]
195-
195+
196196
steps:
197197
- uses: actions/checkout@v4
198198
with:
199199
ref: v${{ needs.analyze-and-version.outputs.new_version }}
200200
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
201-
201+
202202
- name: Set up Python
203203
uses: actions/setup-python@v5
204204
with:
@@ -208,19 +208,19 @@ jobs:
208208
uses: dtolnay/rust-toolchain@stable
209209
with:
210210
components: rustfmt, clippy
211-
211+
212212
- name: Check Rust formatting
213213
run: cargo fmt --all -- --check
214-
214+
215215
- name: Run Rust linting
216216
run: cargo clippy --all-targets --all-features -- -D warnings
217-
217+
218218
- name: Install maturin
219219
run: pip install maturin
220-
220+
221221
- name: Build wheels
222222
run: maturin build --release --out dist --find-interpreter
223-
223+
224224
- name: Upload wheels
225225
uses: actions/upload-artifact@v4
226226
with:

0 commit comments

Comments
 (0)