[llvm] ci: Fix `pr-code-format` permissions for private forks (PR #120838)

via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 21 06:31:20 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-github-workflow

Author: None (whisperity)

<details>
<summary>Changes</summary>

The action requires the ability to change the contents of a pull request (by adding the formatting-related comment) which is only possible through the `write` permission, but if this permission is missing, potential private forks with Actions enabled will break, and because the action triggers on `pull_request_target` even a PR initially fixing this issue downstream will not exhibit the fix until merged.

---
Full diff: https://github.com/llvm/llvm-project/pull/120838.diff


1 Files Affected:

- (modified) .github/workflows/pr-code-format.yml (+2) 


``````````diff
diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml
index f2bb37316d3a8b..fda5b6d96e78c2 100644
--- a/.github/workflows/pr-code-format.yml
+++ b/.github/workflows/pr-code-format.yml
@@ -2,6 +2,8 @@ name: "Check code formatting"
 
 permissions:
   contents: read
+  issues: write
+  pull-requests: write
 
 on:
   pull_request:

``````````

</details>


https://github.com/llvm/llvm-project/pull/120838


More information about the llvm-commits mailing list