Skip to content

Commit c584f33

Browse files
authored
[ci] Renames the override post-release label for batch release (#11835)
The repo check ci will be run when creating release pr against release branch. In that case, we want to ignore the check to guard changes to changelog.md and pubspec. The solution will be reusing the `override: post-release-*` label. I decide to also rename the label to `override: skip-batch-release-repo-check-*` since the original name is not appropriate in this use case. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 03352b5 commit c584f33

4 files changed

Lines changed: 15 additions & 10 deletions

File tree

.github/workflows/batch_release_pr.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
--base "${{ needs.create_batch_release_branch.outputs.release_branch }}" \
6969
--head "${{ env.HEAD_BRANCH_NAME }}" \
7070
--title "[${{ github.event.client_payload.package }}] Batch release" \
71-
--body "This PR was created automatically to batch release the \`${{ github.event.client_payload.package }}\`."
71+
--body "This PR was created automatically to batch release the \`${{ github.event.client_payload.package }}\`." \
72+
--label "override: skip-batch-release-repo-check-${{ github.event.client_payload.package }}"
7273
7374

.github/workflows/sync_release_pr.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ jobs:
3535
exit 0
3636
fi
3737
38-
# 3. Extract release name without version for label
38+
# 3. Extract package name for label
3939
BRANCH_NAME="${{ github.ref_name }}"
40-
RELEASE_NAME="${BRANCH_NAME%-*}"
40+
TEMP="${BRANCH_NAME#release-}"
41+
PACKAGE_NAME="${TEMP%-*}"
4142
4243
# 4. Create the PR directly
4344
gh pr create \
4445
--base "main" \
4546
--head "${{ github.ref_name }}" \
4647
--title "Sync ${{ github.ref_name }} to main" \
4748
--body "This automated PR syncs the changes from the release branch ${{ github.ref_name }} back to the main branch." \
48-
--label "override: post-${RELEASE_NAME}"
49+
--label "override: skip-batch-release-repo-check-${PACKAGE_NAME}"

script/tool/lib/src/validators/version_and_changelog_validator.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,15 @@ class VersionAndChangelogValidator {
164164
pubspec: pubspec,
165165
ignorePlatformInterfaceBreaks: ignorePlatformInterfaceBreaks,
166166
);
167-
// PR with post release label is going to sync changelog.md and pubspec.yaml
168-
// change back to main branch. Proceed with regular version check.
169-
final bool hasPostReleaseLabel = _prLabels.contains('override: post-release-${pubspec.name}');
167+
// PR with override: skip-batch-release-repo-check-<package> label is going to sync
168+
// changelog.md and pubspec.yaml changes back to main branch.
169+
// Proceed with regular version check.
170+
final bool shouldSkipBatchReleaseRepoCheck = _prLabels.contains(
171+
'override: skip-batch-release-repo-check-${pubspec.name}',
172+
);
170173
bool versionChanged;
171174

172-
if (usesBatchRelease && !hasPostReleaseLabel) {
175+
if (usesBatchRelease && !shouldSkipBatchReleaseRepoCheck) {
173176
versionChanged = await _validatePendingChangeForBatchReleasePackage(
174177
package: package,
175178
changedFiles: _changedFiles,

script/tool/test/validate_command_version_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ release:
15841584
);
15851585
});
15861586
test(
1587-
'ignores changelog and pubspec yaml version modifications check with override: post-release label',
1587+
'ignores changelog and pubspec yaml version modifications check with override: skip-batch-release-repo-check label',
15881588
() async {
15891589
final RepositoryPackage package = createFakePackage(
15901590
'package',
@@ -1615,7 +1615,7 @@ packages/package/pubspec.yaml
16151615
final List<String> output = await runCapturingPrint(runner, <String>[
16161616
'validate',
16171617
'--base-sha=main',
1618-
'--pr-labels=override: post-release-package',
1618+
'--pr-labels=override: skip-batch-release-repo-check-package',
16191619
]);
16201620

16211621
expect(

0 commit comments

Comments
 (0)