Skip to content

[iOS] Grant statuses:write so Danger can post required PR commit statuses#4079

Open
sfdctaka wants to merge 1 commit into
forcedotcom:devfrom
sfdctaka:feature/W-23096603-statuses-write-permission
Open

[iOS] Grant statuses:write so Danger can post required PR commit statuses#4079
sfdctaka wants to merge 1 commit into
forcedotcom:devfrom
sfdctaka:feature/W-23096603-statuses-write-permission

Conversation

@sfdctaka

@sfdctaka sfdctaka commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add statuses: write to the static-analysis and test-orchestrator job-level permission blocks in .github/workflows/pr.yaml.
  • Both jobs run Danger to post the danger/StaticAnalysis and danger/TestOrchestrator commit statuses required by dev's branch protection. Without statuses: write, Danger's status calls are rejected (Danger does not have write access to the PR to set a PR status.), so the required statuses never appear and PRs cannot merge even when every check completes successfully.
  • Two-line diff, one new permission scope per job.

Note (the irony)

This very PR will hit the same blocker until it merges. The required danger/StaticAnalysis and danger/TestOrchestrator commit statuses will not appear on this PR's head commit, because the workflow run evaluating it is still running with the old (insufficient) permissions. The merge button will stay disabled even after approval. Someone with admin rights will likely need to bypass branch protection once to land this. After that, every subsequent PR run picks up the new permission and unblocks automatically.

Test plan

  • After merge, observe that the next PR run posts both danger/StaticAnalysis and danger/TestOrchestrator commit statuses on its head commit.

…R commit statuses

The static-analysis and test-orchestrator jobs run Danger to post the
danger/StaticAnalysis and danger/TestOrchestrator commit statuses that the
dev branch protection requires. Their job-level permission blocks granted
contents:read and pull-requests:write but not statuses:write, so Danger's
status calls were rejected ("Danger does not have write access to the PR
to set a PR status."). The required statuses never appeared, leaving every
PR perpetually blocked from merge even when all checks completed
successfully.
@sfdctaka sfdctaka requested a review from brandonpage June 20, 2026 00:44
@github-actions

Copy link
Copy Markdown
TestsPassed ✅SkippedFailed
AuthFlowTester UI Test Results all1 ran1 ✅
TestResult
No test annotations available

@github-actions

Copy link
Copy Markdown
TestsPassed ☑️SkippedFailed ❌️
SalesforceSDKCore iOS ^26 Test Results652 ran647 ✅5 ❌
TestResult
SalesforceSDKCore iOS ^26 Test Results
RestClientPublisherTests.testBatchPublisher()❌ failure
RestClientPublisherTests.testCompositePublisher()❌ failure
RestClientPublisherTests.testQueryPublisher()❌ failure
RestClientPublisherTests.testRecordsPublisher()❌ failure
SalesforceRestAPITests.testUpdateWithIfUnmodifiedSince❌ failure

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.35%. Comparing base (26a5133) to head (059dc66).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4079      +/-   ##
==========================================
- Coverage   70.83%   68.35%   -2.49%     
==========================================
  Files         246      246              
  Lines       21495    21495              
==========================================
- Hits        15227    14692     -535     
- Misses       6268     6803     +535     
Components Coverage Δ
Analytics 70.78% <ø> (ø)
Common 71.25% <ø> (-0.19%) ⬇️
Core 61.84% <ø> (-3.85%) ⬇️
SmartStore 73.44% <ø> (ø)
MobileSync 88.88% <ø> (ø)
see 29 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown
TestsPassed ☑️SkippedFailed ❌️
SalesforceSDKCore iOS ^18 Test Results652 ran651 ✅1 ❌
TestResult
SalesforceSDKCore iOS ^18 Test Results
SalesforceRestAPITests.testCreateQuerySearchDelete❌ failure

@sfdctaka sfdctaka requested review from bbirman and wmathurin June 20, 2026 00:58
@bbirman

bbirman commented Jun 20, 2026

Copy link
Copy Markdown
Member

What changed for it to stop working?

@sfdctaka

Copy link
Copy Markdown
Contributor Author

What changed for it to stop working?

In #4047 (2026-05-29, "fix security issues") explicit per-job permissions: blocks were added to harden the pull_request_target workflow:

  permissions:
    contents: read
    pull-requests: write

The intent was correct, but in GitHub Actions any job-level permissions: block replaces the default GITHUB_TOKEN scopes rather than adding to them — anything not listed is dropped. The default token had implicit statuses: write; the new block doesn't, so Danger silently lost the ability to post commit statuses. Its log line is:

▎ Danger does not have write access to the PR to set a PR status.

The two required contexts (danger/StaticAnalysis, danger/TestOrchestrator) have not been posted on PR head commits since that merge. We didn't notice because dev branch protection has enforce_admins: false, so admin merges have been bypassing the missing required statuses — masking the regression for ~3 weeks. Non-admin PRs
(and admin PRs not bypassed) sit blocked.

This PR adds statuses: write back to the two job permission blocks. Two-line change, no other behavior affected.

@bbirman bbirman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm but I'd want @brandonpage's approval too

@sfdctaka

Copy link
Copy Markdown
Contributor Author

@brandonpage Can you check this PR please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants