Skip to content
Merged
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
28 changes: 24 additions & 4 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ on:
type: boolean
default: false
fetch-depth:
description: Number of commits to fetch (0 for full history)
description: Number of commits to fetch (0 for full history, empty for auto-detect)
required: false
type: number
default: 1
type: string
default: ''
cache-name:
description: Name for cache restore (restores {name}.gz with key {name}-)
required: false
Expand All @@ -90,11 +90,31 @@ jobs:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
steps:
- name: Calculate fetch depth
id: depth
env:
FETCH_DEPTH: ${{ inputs.fetch-depth }}
PR_COMMITS: ${{ github.event.pull_request.commits }}
run: |
# Use explicit value if provided
if [ -n "$FETCH_DEPTH" ]; then
echo "val=$FETCH_DEPTH" >> "$GITHUB_OUTPUT"
# For PRs, use commit count plus buffer for merge base
elif [ -n "$PR_COMMITS" ]; then
echo "val=$((PR_COMMITS + 2))" >> "$GITHUB_OUTPUT"
# For push events, read commit count from event payload
else
COMMIT_COUNT=$(jq -e '.commits | length // 0' "$GITHUB_EVENT_PATH" 2>/dev/null) || COMMIT_COUNT=0
echo "val=$((COMMIT_COUNT + 1))" >> "$GITHUB_OUTPUT"
fi
- name: Checkout source tree
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
fetch-depth: ${{ inputs.fetch-depth }}
fetch-depth: ${{ steps.depth.outputs.val }}
- name: Fetch base ref for PR comparison
if: github.event.pull_request.base.sha
run: git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
- name: Pull latest changes from head ref for PRs
if: contains(github.head_ref, 'renovate/')
run: git pull origin "$HEAD_REF"
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci-grid-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
steps:
- name: Checkout source tree
uses: actions/checkout@v4
with:
fetch-depth: 50

- name: Setup Node.js
uses: actions/setup-node@v4
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
with:
name: Check Targets
cache-name: bazel-test-target-index
fetch-depth: 50
run: |
if [ "${{ github.event_name }}" == "schedule" ] || \
[ "${{ github.event_name }}" == "workflow_call" ] || \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/mirror-selenium-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Read api.github.com and filter response
run: |
set -euo pipefail
Expand Down
45 changes: 43 additions & 2 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,56 @@ jobs:
run: ./go all:version ${{ needs.normalize-version.outputs.version }}
artifact-name: patch-versions

calculate-changelog-depth:
name: Calculate Changelog Depth
needs: normalize-version
runs-on: ubuntu-latest
outputs:
depth: ${{ steps.calc.outputs.depth }}
steps:
- name: Calculate fetch depth from tag
id: calc
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ needs.normalize-version.outputs.version }}
run: |
set -euo pipefail
if [[ "$VERSION" =~ ([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
MAJOR=${BASH_REMATCH[1]}
MINOR=${BASH_REMATCH[2]}
PATCH=${BASH_REMATCH[3]}

if [ "$PATCH" -gt 1 ]; then
PREV="selenium-${MAJOR}.${MINOR}.$((PATCH-1))"
elif [ "$PATCH" -eq 1 ]; then
PREV="selenium-${MAJOR}.${MINOR}.0"
elif [ "$MINOR" -gt 0 ]; then
PREV="selenium-${MAJOR}.$((MINOR-1)).0"
else
# First release of major version (X.0.0), use full history
echo "depth=0" >> "$GITHUB_OUTPUT"
exit 0
fi

COUNT=$(gh api "repos/${{ github.repository }}/compare/${PREV}...${{ github.sha }}" --jq '.total_commits' 2>/dev/null) || {
echo "::warning::Failed to get commit count, using full history"
echo "depth=0" >> "$GITHUB_OUTPUT"
exit 0
}
echo "depth=$((COUNT + 1))" >> "$GITHUB_OUTPUT"
else
echo "depth=0" >> "$GITHUB_OUTPUT"
fi

generate-changelogs:
name: Generate Changelogs
needs: [restrict-trunk, normalize-version]
needs: [restrict-trunk, normalize-version, calculate-changelog-depth]
uses: ./.github/workflows/bazel.yml
with:
name: Update Changelogs
run: ./go all:changelogs && ./go rust:changelogs
artifact-name: patch-changelogs
fetch-depth: ${{ needs.calculate-changelog-depth.outputs.depth }}

create-pr:
name: Create Pull Request
Expand All @@ -156,7 +198,6 @@ jobs:
with:
token: ${{ secrets.SELENIUM_CI_TOKEN }}
ref: trunk
fetch-depth: 0
- name: Get latest trunk
run: git pull --ff-only origin trunk
- name: Download all patches
Expand Down