Skip to content

Commit 0732237

Browse files
Copilotpetesramek
andauthored
fix: address review comments - normalize version comparison, add checkout to validate job, combine find commands, improve lock action error handling
Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/4418acb6-8233-47f4-9b0f-9f6f4de0fb09 Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com>
1 parent 5d896a7 commit 0732237

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

.github/actions/github/branch-protection/lock/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runs:
1414
env:
1515
GH_TOKEN: ${{ github.token }}
1616
run: |
17-
gh api --method PUT /repos/${{ github.repository }}/branches/${{ inputs.branch }}/protection \
17+
if ! gh api --method PUT /repos/${{ github.repository }}/branches/${{ inputs.branch }}/protection \
1818
--input - << 'EOF'
1919
{
2020
"required_status_checks": null,
@@ -30,4 +30,8 @@ runs:
3030
"lock_branch": false
3131
}
3232
EOF
33+
then
34+
echo "::error::Failed to apply branch protection to '${{ inputs.branch }}'. Ensure the token has 'administration: write' permission and the branch exists."
35+
exit 1
36+
fi
3337
echo "🔒 Branch '${{ inputs.branch }}' is now protected." >> $GITHUB_STEP_SUMMARY

.github/workflows/bump-version.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ jobs:
7272
needs: [detect-version]
7373
runs-on: ubuntu-latest
7474
steps:
75+
- name: 'Checkout main'
76+
uses: actions/checkout@v6
77+
with:
78+
ref: main
79+
fetch-depth: 1
80+
7581
- name: 'Validate workflow is running from main'
7682
if: ${{ github.ref_name != 'main' }}
7783
run: |
@@ -119,11 +125,7 @@ jobs:
119125
- name: 'Reset PublicAPI files for major bump'
120126
if: ${{ inputs.bump-type == 'major' }}
121127
run: |
122-
find . -name "PublicAPI.Shipped.txt" | while read file; do
123-
printf '\xef\xbb\xbf#nullable enable\n' > "$file"
124-
echo "Reset: $file"
125-
done
126-
find . -name "PublicAPI.Unshipped.txt" | while read file; do
128+
find . \( -name "PublicAPI.Shipped.txt" -o -name "PublicAPI.Unshipped.txt" \) | while read file; do
127129
printf '\xef\xbb\xbf#nullable enable\n' > "$file"
128130
echo "Reset: $file"
129131
done

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,10 @@ jobs:
278278
run: |
279279
git fetch origin
280280
latest_version=$(git ls-remote --heads origin 'release/*' | grep -oP 'release/\K\d+\.\d+' | sort -V | tail -1)
281+
current_version=$(echo "${{ env.current-version }}" | grep -oP '^\d+\.\d+')
281282
echo "Latest release branch version: $latest_version"
282-
echo "Current version: ${{ env.current-version }}"
283-
if [[ "$latest_version" == "${{ env.current-version }}" ]]; then
283+
echo "Current version (normalized): $current_version"
284+
if [[ "$latest_version" == "$current_version" ]]; then
284285
echo "is-latest=true" >> $GITHUB_OUTPUT
285286
else
286287
echo "is-latest=false" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)