Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions actions/setup/js/create_pull_request.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,10 @@ ${diffs}
expect(createCall.body).toContain("/compare/main...");
expect(createCall.body).not.toContain("gh run download");
expect(createCall.body).not.toContain("git am --3way");
expect(createCall.body).toContain("Your pull request is ready to create! 🎉 ✅");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] The regression test covers the protected-file fallback body ordering, but there is no parallel test for pr_permission_denied_fallback.md — leaving that template's new heading order unverified.

💡 Suggested approach

Add equivalent indexOf-ordering assertions in the permission-denied fallback test, similar to the four lines added here:

expect(createCall.body).toContain("Your pull request is ready to create! 🎉 ✅");
expect(createCall.body.indexOf("Your pull request is ready to create! 🎉 ✅"))
  .toBeLessThan(createCall.body.indexOf(/* original body content */));

This ensures both fallback paths stay consistent as the templates evolve.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added parallel permission-denied fallback assertions covering tip → original body → permission details → footer ordering. Commit: $(git rev-parse --short HEAD).

expect(createCall.body).toContain("The original pull request description is below.");
expect(createCall.body.indexOf("Your pull request is ready to create! 🎉 ✅")).toBeLessThan(createCall.body.indexOf("Test body"));
expect(createCall.body.indexOf("Test body")).toBeLessThan(createCall.body.indexOf("Protected files"));
});

it("should push branch with compare URL for protected-files fallback (bundle transport)", async () => {
Expand Down
19 changes: 14 additions & 5 deletions actions/setup/md/manifest_protection_create_pr_fallback.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
> [!TIP]
> **Your pull request is ready to create! 🎉 ✅**
>
> Everything is OK—the changes have been pushed to a branch. Please review the protected files, then create the pull request when you are ready.
>
> **[Create the pull request]({create_pr_url})**
>
> The original pull request description is below.

---

{main_body}

---

> [!WARNING]
> **Protected Files**
>
> This was originally intended as a pull request, but the patch modifies protected files. These files may affect project dependencies, CI/CD pipelines, or agent behaviour. **Please review the changes carefully** before creating the pull request.
> [!NOTE]
> **Protected files**
>
> **[Click here to create the pull request once you have reviewed the changes]({create_pr_url})**
> This patch modifies protected files, which may affect project dependencies, CI/CD pipelines, or agent behaviour.
>
> <details>
> <summary>Protected files</summary>
Expand Down
16 changes: 12 additions & 4 deletions actions/setup/md/pr_permission_denied_fallback.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
> [!TIP]
> **Your pull request is ready to create! 🎉 ✅**
>
> Everything is OK—the changes have been pushed to branch `{branch_name}`. Create the pull request when you are ready.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot This should also explain that the PR changes some protected files, which the user needs to review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the permission-denied fallback callout to ask users to review the changes, including any protected files, before creating the PR. Commit: c3d474a.

>
> **[Create the pull request]({create_pr_url})**
>
> The original pull request description is below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the permission-denied fallback to pass the footer-free main body and footer separately, placing the permission guidance before the footer. Added ordering regression coverage. Commit: $(git rev-parse --short HEAD).


---

{body}

---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] The > [!NOTE] block now loses the context that the changes were pushed and the user should review them. The manifest_protection_create_pr_fallback.md counterpart retains "Please review the protected files, then create the pull request when you are ready", but this template omits equivalent guidance.

💡 Suggested fix

Add a brief reassurance sentence:

> [!NOTE]
> GitHub 操作 is not permitted to create or approve pull requests in this repository.
> The changes have been pushed to branch `{branch_name}` and are ready to review.

This keeps the two templates symmetric and ensures users understand the state of their changes.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added explicit guidance that the pushed changes are ready for review in the permission-denied fallback note. Commit: $(git rev-parse --short HEAD).


> [!NOTE]
> This was originally intended as a pull request, but GitHub 操作 is not permitted to create or approve pull requests in this repository.
> The changes have been pushed to branch `{branch_name}`.
>
> **[Click here to create the pull request]({create_pr_url})**
> GitHub 操作 is not permitted to create or approve pull requests in this repository.

To fix the permissions issue, go to **设置** → **操作** → **General** and enable **Allow GitHub 操作 to create and approve pull requests**. See also: [gh-aw FAQ]({faq_url}){patch_preview}
Loading