mirror of
https://github.com/woocommerce/woocommerce.git
synced 2025-08-18 01:58:54 +08:00
Label PRs merged after Feature Freeze (#60250)
This commit is contained in:
parent
6c7fad08d5
commit
f724d7faf3
6 changed files with 83 additions and 17 deletions
|
@ -57,6 +57,20 @@ jobs:
|
|||
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
process-feature-freeze-exception:
|
||||
name: Log the merge of a Feature Freeze exception
|
||||
if: ${{ github.event.pull_request.merged && startsWith( github.event.pull_request.base.ref, 'release/' ) && ! contains( github.event.pull_request.labels.*.name, 'Release' ) }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh pr edit ${{ github.event.pull_request.number }} \
|
||||
--add-label "metric: feature freeze exception" \
|
||||
--repo ${{ github.repository }}
|
||||
|
||||
process-pull-request-after-close:
|
||||
name: "Process a pull request after it's been closed"
|
||||
runs-on: ubuntu-latest
|
||||
|
|
3
.github/workflows/release-bump-version.yml
vendored
3
.github/workflows/release-bump-version.yml
vendored
|
@ -170,7 +170,8 @@ jobs:
|
|||
--title 'Bump WooCommerce version to ${{ steps.compute-new-version.outputs.nextVersion }}' \
|
||||
--body 'This PR updates the versions in ${{ inputs.branch }} to ${{ steps.compute-new-version.outputs.nextVersion }}.' \
|
||||
--base ${{ inputs.branch }} \
|
||||
--head ${branch_name}
|
||||
--head ${branch_name} \
|
||||
--label Release
|
||||
|
||||
- name: Ensure milestone for dev version exists
|
||||
if: ${{ inputs.bump-type == 'dev' }}
|
||||
|
|
|
@ -87,7 +87,7 @@ jobs:
|
|||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: trunk
|
||||
|
||||
- name: Check the necessary branch exists
|
||||
id: check-branch
|
||||
|
@ -123,7 +123,8 @@ jobs:
|
|||
VERSION: ${{ steps.validate-version.outputs.version }}
|
||||
SELECTED_BRANCH: ${{ steps.check-branch.outputs.selected_branch }}
|
||||
run: |
|
||||
git checkout $SELECTED_BRANCH
|
||||
git fetch origin ${SELECTED_BRANCH}
|
||||
git checkout ${SELECTED_BRANCH}
|
||||
current_version=$( cat plugins/woocommerce/woocommerce.php | grep -oP '(?<=Version: )(.+)' | head -n1 )
|
||||
|
||||
echo "Current version from woocommerce.php: '$current_version'"
|
||||
|
@ -136,6 +137,9 @@ jobs:
|
|||
|
||||
echo "current_version=$current_version" >> $GITHUB_OUTPUT
|
||||
|
||||
# Go back to trunk.
|
||||
git checkout trunk
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
||||
|
||||
|
|
22
.github/workflows/release-trends-analysis.yml
vendored
22
.github/workflows/release-trends-analysis.yml
vendored
|
@ -15,15 +15,15 @@ jobs:
|
|||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
run: |
|
||||
cfes=$( gh pr list --search "is:pr milestone:${{ inputs.milestone }} is:closed label:\"metric: code freeze exception\"" --json url | jq --compact-output '.[]' | jq --raw-output '( "- " + .url )' )
|
||||
cfes=$( gh pr list --search "is:pr milestone:${{ inputs.milestone }} is:closed label:\"metric: feature freeze exception\"" --json url | jq --compact-output '.[]' | jq --raw-output '( "- " + .url )' )
|
||||
issue=$( gh issue create --title "[Release] trend analysis for ${{ inputs.milestone }} milestone (CFEs)" --assignee "${{ github.actor }}" --body "Generated automatically via release-trends-analysis.yml." | grep '/issues/' | sed -E 's/[^0-9]*//' )
|
||||
|
||||
|
||||
gh issue comment ${issue} --body "
|
||||
@coderabbitai: for the following GitHub PRs:
|
||||
${cfes}
|
||||
|
||||
|
||||
please analyze the similarity and trends. When reporting results, please provide a separate comment on the criteria used for classification and grouping.
|
||||
|
||||
|
||||
Additional instructions:
|
||||
- If processing any of the PRs takes more than 5 minutes, please skip it and report the list of skipped PRs in the full/final summary.
|
||||
- When starting to process this request, please estimate and memorize how much time it can take to complete the request processing.
|
||||
|
@ -41,13 +41,13 @@ jobs:
|
|||
run: |
|
||||
prrs=$( gh issue list --search "is:issue milestone:${{ inputs.milestone }} state:closed label:\"point release request\"" --json url | jq --compact-output '.[]' | jq --raw-output '( "- " + .url )' )
|
||||
issue=$( gh issue create --title "[Release] trend analysis for ${{ inputs.milestone }} milestone (PRRs)" --assignee "${{ github.actor }}" --body "Generated automatically via release-trends-analysis.yml." | grep '/issues/' | sed -E 's/[^0-9]*//' )
|
||||
|
||||
|
||||
gh issue comment ${issue} --body "
|
||||
@coderabbitai: for the following GitHub issues and their comments:
|
||||
${prrs}
|
||||
|
||||
|
||||
please analyze the similarity and trends. When reporting results, please provide a separate comment on the criteria used for classification and grouping.
|
||||
|
||||
|
||||
Additional instructions:
|
||||
- If processing any of the issues takes more than 5 minutes, please skip it and report the list of skipped issues in the full/final summary.
|
||||
- When starting to process this request, please estimate and memorize how much time it can take to complete the request processing.
|
||||
|
@ -63,24 +63,24 @@ jobs:
|
|||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
run: |
|
||||
cfes=$( gh pr list --search "is:pr milestone:${{ inputs.milestone }} is:closed label:\"metric: code freeze exception\"" --json url | jq --compact-output '.[]' | jq --raw-output '( "- " + .url )' )
|
||||
cfes=$( gh pr list --search "is:pr milestone:${{ inputs.milestone }} is:closed label:\"metric: feature freeze exception\"" --json url | jq --compact-output '.[]' | jq --raw-output '( "- " + .url )' )
|
||||
prrs=$( gh issue list --search "is:issue milestone:${{ inputs.milestone }} state:closed label:\"point release request\"" --json url | jq --compact-output '.[]' | jq --raw-output '( "- " + .url )' )
|
||||
issue=$( gh issue create --title "[Release] quality trend analysis for ${{ inputs.milestone }} milestone (CFEs and PRRs)" --assignee "${{ github.actor }}" --body "Generated automatically via release-trends-analysis.yml." | grep '/issues/' | sed -E 's/[^0-9]*//' )
|
||||
|
||||
gh issue comment ${issue} --body "
|
||||
@coderabbitai: for the following GitHub issues and their comments:
|
||||
${prrs}
|
||||
|
||||
|
||||
and the following GitHub PRs:
|
||||
${cfes}
|
||||
|
||||
|
||||
please answer the following questions (full report):
|
||||
- What are the changes types (one of the following options: bug fix, performance fix, enhancement, configuration changes, maintenance, other)?
|
||||
- What are the root causes (one of the following options: backward compatibility break, strict types issue, loose types issue, error/exception handling issue, validation issue, business logic issue, configuration issue, environment issue, other)?
|
||||
- Replace the 'other' option from above with one of your choice, which is fit to the PR context.
|
||||
- Which PRs, in your opinion, address issues caused by the technical debt?
|
||||
- Explain your definitions for the options listed above.
|
||||
|
||||
|
||||
Additional instructions:
|
||||
- If processing any of the issues/PRs takes more than 5 minutes, please skip it and report the list of skipped issues/PRs in the full/final summary.
|
||||
- When starting to process this request, please estimate and memorize how much time it can take to complete the request processing.
|
||||
|
|
|
@ -12,7 +12,10 @@ import { readFileSync } from 'fs';
|
|||
*/
|
||||
import { Logger } from '../../../../core/logger';
|
||||
import { checkoutRemoteBranch } from '../../../../core/git';
|
||||
import { createPullRequest } from '../../../../core/github/repo';
|
||||
import {
|
||||
addLabelsToIssue,
|
||||
createPullRequest,
|
||||
} from '../../../../core/github/repo';
|
||||
import { Options } from '../types';
|
||||
import { getToday } from '../../get-version/lib';
|
||||
|
||||
|
@ -179,6 +182,17 @@ export const updateReleaseBranchChangelogs = async (
|
|||
base: releaseBranch,
|
||||
} );
|
||||
Logger.notice( `Pull request created: ${ pullRequest.html_url }` );
|
||||
|
||||
try {
|
||||
await addLabelsToIssue( options, pullRequest.number, [
|
||||
'Release',
|
||||
] );
|
||||
} catch {
|
||||
Logger.warn(
|
||||
`Could not add label "Release" to PR ${ pullRequest.number }`
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
deletionCommitHash: deletionCommitHash.trim(),
|
||||
prNumber: pullRequest.number,
|
||||
|
@ -197,13 +211,14 @@ export const updateReleaseBranchChangelogs = async (
|
|||
* @param {Object} releaseBranchChanges update data from updateReleaseBranchChangelogs
|
||||
* @param {Object} releaseBranchChanges.deletionCommitHash commit from the changelog deletions in updateReleaseBranchChangelogs
|
||||
* @param {Object} releaseBranchChanges.prNumber pr number created in updateReleaseBranchChangelogs
|
||||
* @return {number} Update PR number.
|
||||
*/
|
||||
export const updateBranchChangelog = async (
|
||||
options: Options,
|
||||
tmpRepoPath: string,
|
||||
releaseBranch: string,
|
||||
releaseBranchChanges: { deletionCommitHash: string; prNumber: number }
|
||||
): Promise< void > => {
|
||||
): Promise< number > => {
|
||||
const { owner, name, version } = options;
|
||||
const { deletionCommitHash, prNumber } = releaseBranchChanges;
|
||||
Logger.notice( `Deleting changelogs from trunk ${ tmpRepoPath }` );
|
||||
|
@ -251,6 +266,18 @@ export const updateBranchChangelog = async (
|
|||
base: releaseBranch,
|
||||
} );
|
||||
Logger.notice( `Pull request created: ${ pullRequest.html_url }` );
|
||||
|
||||
try {
|
||||
await addLabelsToIssue( options, pullRequest.number, [
|
||||
'Release',
|
||||
] );
|
||||
} catch {
|
||||
Logger.warn(
|
||||
`Could not add label "Release" to PR ${ pullRequest.number }`
|
||||
);
|
||||
}
|
||||
|
||||
return pullRequest.number;
|
||||
} catch ( e ) {
|
||||
if ( e.message.includes( `No commits between ${ releaseBranch }` ) ) {
|
||||
Logger.notice(
|
||||
|
@ -281,7 +308,7 @@ export const updateTrunkChangelog = async (
|
|||
options: Options,
|
||||
tmpRepoPath: string,
|
||||
releaseBranchChanges: { deletionCommitHash: string; prNumber: number }
|
||||
): Promise< void > => {
|
||||
): Promise< number > => {
|
||||
return await updateBranchChangelog(
|
||||
options,
|
||||
tmpRepoPath,
|
||||
|
|
|
@ -229,6 +229,26 @@ export const deleteGithubBranch = async (
|
|||
);
|
||||
};
|
||||
|
||||
export const addLabelsToIssue = async (
|
||||
options: {
|
||||
owner?: string;
|
||||
name?: string;
|
||||
},
|
||||
issueNumber: number,
|
||||
labels: string[]
|
||||
): Promise< void > => {
|
||||
const { owner, name } = options;
|
||||
await octokitWithAuth().request(
|
||||
'POST /repos/{owner}/{repo}/issues/{issue_number}/labels',
|
||||
{
|
||||
owner,
|
||||
repo: name,
|
||||
issue_number: issueNumber,
|
||||
labels,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a pull request from branches on Github.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue