@@ -38,7 +38,39 @@ We use a Personal Access Token (PAT) with bypass permissions to allow semantic-r
3838 - ** Name** : ` GH_PAT `
3939 - ** Secret** : Paste the token you created
4040
41- ### 3. Configure Branch Protection Rules
41+ ### 3. Configure Branch Protection (Rulesets or Legacy)
42+
43+ #### Option A: GitHub Rulesets (Recommended - Newer Repositories)
44+
45+ ** Important** : Deploy keys do NOT work with rulesets for semantic-release. You need to bypass for specific actors.
46+
47+ 1 . Go to Settings → Rules → Rulesets
48+ 2 . Find or create a ruleset that applies to the ` main ` branch
49+ 3 . Configure bypass permissions:
50+
51+ ** Method 1: Bypass for Repository Admin (Simplest)**
52+ - Under "Bypass list", click "Add bypass"
53+ - Select "Repository admin"
54+ - This allows repository admins to bypass (semantic-release will use admin PAT)
55+
56+ ** Method 2: Bypass for GitHub App**
57+ - Under "Bypass list", click "Add bypass"
58+ - Select "GitHub Apps"
59+ - Add the GitHub Actions app if available
60+
61+ ** Method 3: Bypass for Specific User**
62+ - Create a PAT (see step 1)
63+ - Under "Bypass list", click "Add bypass"
64+ - Select "Organization members" or "Repository collaborators"
65+ - Add the user who owns the PAT
66+
67+ 4 . Ensure these ruleset settings allow semantic-release to work:
68+ - ** Require pull request before merging** : Add bypass for your chosen actor
69+ - ** Require status checks to pass** : Add bypass for your chosen actor
70+ - ** Require linear history** : Can be enabled (semantic-release creates merge commits)
71+ - ** Block force pushes** : Keep enabled (semantic-release doesn't force push)
72+
73+ #### Option B: Legacy Branch Protection Rules
4274
43751 . Go to Settings → Branches → Branch protection rules
44762 . Edit the rule for ` main `
@@ -145,8 +177,15 @@ This creates releases without pushing version bumps back to main.
145177
146178Solution: The PAT needs "Workflows" permission. Recreate the token with this permission added.
147179
148- ### "protected branch hook declined"
180+ ### "protected branch hook declined" or "Resource protected by organization SAML enforcement"
149181
182+ ** For GitHub Rulesets:**
183+ 1 . Verify the PAT owner is in the bypass list (not deploy keys)
184+ 2 . Check Settings → Rules → Rulesets → View ruleset runs to see why it was blocked
185+ 3 . Ensure the ruleset bypass includes the correct actor type (Repository admin, Org member, or App)
186+ 4 . If using org-level rulesets, you may need org admin permissions
187+
188+ ** For Legacy Protection:**
150189Solution: Ensure the PAT user or github-actions[ bot] is in the bypass list for branch protection.
151190
152191### "Author identity unknown"
@@ -158,8 +197,69 @@ Solution: The workflow sets `GIT_AUTHOR_NAME` and `GIT_AUTHOR_EMAIL` environment
158197Check:
1591981 . ` GH_PAT ` secret is properly set
1601992 . PAT has not expired
161- 3 . PAT has correct permissions
162- 4 . Branch protection allows bypass
200+ 3 . PAT has correct permissions (Contents: R/W minimum)
201+ 4 . Branch protection/rulesets allow bypass for the PAT owner
202+ 5 . PAT is authorized for SSO (if applicable)
203+
204+ ### Deploy keys don't work with Rulesets
205+
206+ This is expected. Deploy keys cannot be added to ruleset bypass lists. Solutions:
207+ 1 . Use a Personal Access Token (PAT) instead
208+ 2 . Add the PAT owner to the ruleset bypass list
209+ 3 . Use "Repository admin" bypass if the PAT is from an admin
210+
211+ ### Verifying Ruleset Configuration
212+
213+ Test if your PAT can push to protected branch:
214+
215+ ``` bash
216+ # Clone with PAT
217+ git clone https://< PAT> @github.com/JuliaPluto/advanced-vscode-extension.git
218+ cd advanced-vscode-extension
219+ git checkout main
220+
221+ # Make a test commit
222+ echo " test" >> test.txt
223+ git add test.txt
224+ git commit -m " test: ruleset bypass"
225+ git push
226+
227+ # If this fails, your ruleset bypass is not configured correctly
228+ # Clean up
229+ git reset --hard HEAD~1
230+ git push --force
231+ ```
232+
233+ ### Alternative: Skip Version Commits
234+
235+ If you can't get rulesets to allow pushes, configure semantic-release to skip version commits and only create tags/releases:
236+
237+ Update ` .releaserc.json ` :
238+ ``` json
239+ {
240+ "branches" : [" main" ],
241+ "plugins" : [
242+ " @semantic-release/commit-analyzer" ,
243+ " @semantic-release/release-notes-generator" ,
244+ [" @semantic-release/npm" , { "npmPublish" : false }],
245+ [" semantic-release-vsce" , { "packageVsix" : true }],
246+ [
247+ " @semantic-release/github" ,
248+ {
249+ "assets" : [
250+ { "path" : " *.vsix" , "label" : " VS Code Extension (VSIX)" }
251+ ]
252+ }
253+ ]
254+ ]
255+ }
256+ ```
257+
258+ This removes:
259+ - ` @semantic-release/changelog ` - no changelog updates
260+ - ` @semantic-release/git ` - no version commits to main
261+
262+ Releases are created without pushing back to the repository.
163263
164264## Security Notes
165265
0 commit comments