Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/9.0.2xx] Update SDK-PR-guide.md to include branch lockdown label #46449

Closed
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
81 changes: 81 additions & 0 deletions .github/workflows/add-lockdown-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Add Branch Lockdown Label to PRs

on:
pull_request_target:
branches-ignore:
- main
workflow_dispatch: # Allows manual triggering of the workflow

permissions:
actions: write # For managing the operation state cache
issues: write

jobs:
add-label:
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install jq
run: sudo apt-get install -y jq

- name: Add label to PRs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Determine the third Tuesday of the current month
third_tuesday=$(date -d "$(date +%Y-%m-01) +14 days" +%Y-%m-%d)
while [ $(date -d "$third_tuesday" +%u) -ne 2 ]; do
third_tuesday=$(date -d "$third_tuesday + 1 day" +%Y-%m-%d)
done

# Determine the first Tuesday of the current month
first_tuesday=$(date -d "$(date +%Y-%m-01)" +%Y-%m-%d)
while [ $(date -d "$first_tuesday" +%u) -ne 2 ]; do
first_tuesday=$(date -d "$first_tuesday + 1 day" +%Y-%m-%d)
done

# Get current date
current_date=$(date +%Y-%m-%d)

echo "Current Date: $current_date"
echo "Third Tuesday of the month: $third_tuesday"
echo "First Tuesday of the month: $first_tuesday"

# Check if the current date is after the third Tuesday of this month or before the first Tuesday of this month
if [[ "$current_date" > "$third_tuesday" || "$current_date" < "$first_tuesday" ]]; then
echo "Within the label period. Checking if the branch matches..."

# Get all open PRs created by app/dotnet-maestro and targeting branches release/8* and release/9* excluding release/9.0.3xx
echo "Running gh pr list query..."
prs=$(gh pr list --state open --limit 100 --json number,baseRefName,author,labels)
echo "Total PRs Count: $(echo "$prs" | jq length)"
echo "PRs JSON: $prs"

echo "Filtering PRs created by app/dotnet-maestro..."
prs_by_author=$(echo "$prs" | jq '[.[] | select(.author.login == "app/dotnet-maestro")]')
echo "Count of PRs by app/dotnet-maestro: $(echo "$prs_by_author" | jq length)"

echo "Filtering PRs targeting release/8* and release/9* excluding release/9.0.3xx..."
prs_targeting_branches=$(echo "$prs_by_author" | jq '[.[] | select(.baseRefName | test("^release/[89].*")) | select(.baseRefName | test("^release/9.0.3xx") | not)]')
echo "Count of PRs targeting specific branches: $(echo "$prs_targeting_branches" | jq length)"

echo "Filtering PRs without Branch Lockdown label..."
filtered_prs=$(echo "$prs_targeting_branches" | jq '[.[] | select(.labels | map(.name) | index("Branch Lockdown") | not) | .number]')
echo "Filtered PRs without Branch Lockdown label JSON: $filtered_prs"
echo "Count of Filtered PRs without Branch Lockdown label: $(echo "$filtered_prs" | jq length)"

# Loop through filtered PRs and add label
for pr in $(echo "$filtered_prs" | jq -r '.[]'); do
echo "Adding label to PR #$pr"
gh pr edit $pr --add-label "Branch Lockdown"
done
else
echo "Outside the label period. No labels added."
fi
4 changes: 2 additions & 2 deletions documentation/project-docs/SDK-PR-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ After the minor release locks down, it transitions into servicing / "QB" (Quarte
### Servicing releases
The .NET SDK has monthly servicing releases (e.g.`7.0.100` VS `7.0.101`) aligning with the .NET Runtime servicing releases. These are for top fixes and security updates only to limit risk.
Any servicing release is open for check-ins from the day the [branding PRs](https://github.com/dotnet/sdk/pulls?q=is%3Apr+branding) are merged (~1st of each month) and when code complete is (typically two weeks later).
The servicing branches are locked from the time of code complete to the next branding in case we need to respin any monthly release. Final signoffs are typically in the last week of each month.
The servicing branches are locked from the time of code complete to the next branding in case we need to respin any monthly release. We use the `Branch Lockdown` label to mark PRs that should go into the next servicing release but the branch is currently not open. Final signoffs are typically in the last week of each month.

### Schedule
| Release Type | Frequency | Lockdown Release | Branch Open | Lockdown Date (estimate) |
Expand All @@ -36,7 +36,7 @@ The servicing branches are locked from the time of code complete to the next bra
| Servicing | Monthly | N/A | After branding, ~1st of the month | Third Tuesday of prior month (signoff is ~28th of each month) |

### Tactics approval
Even releases that are in lockdown can still take changes as long as they are approved and the final build isn't complete. To bring a change through tactics, mark it with the label servicing-consider and update the description to include 5 sections (Description, Customer Impact, Regression?, Risk, Testing). See previously approved bugs for examples by looking for the [servicing-approved](https://github.com/dotnet/sdk/pulls?q=is%3Apr+label%3AServicing-approved+is%3Aclosed) label.
Even releases that are in lockdown can still take changes as long as they are approved and the final build isn't complete. To bring a change through tactics, mark it with the label `servicing-consider` and update the description to include 5 sections (Description, Customer Impact, Regression?, Risk, Testing). See previously approved bugs for examples by looking for the [servicing-approved](https://github.com/dotnet/sdk/pulls?q=is%3Apr+label%3AServicing-approved+is%3Aclosed) label.

## External contributions
External contributions are encouraged and welcome. There are so many teams working in this repo that it can be hard to track. Contributors looking to learn more about how to contribute should check out the [Developer Guide](https://github.com/dotnet/sdk/blob/main/documentation/project-docs/developer-guide.md).
Expand Down
Loading