Skip to content

fix: use cascading org checks for PR redirect workflow#586

Merged
brandom-msft merged 1 commit intomainfrom
fix/redirect-cascading-org-check
Mar 9, 2026
Merged

fix: use cascading org checks for PR redirect workflow#586
brandom-msft merged 1 commit intomainfrom
fix/redirect-cascading-org-check

Conversation

@brandom-msft
Copy link
Member

Problem

The redirect workflow uses orgs.checkMembershipForUser against the microsoft org, but the GITHUB_TOKEN (scoped to microsoft-foundry) can only see public members. Contributors with private microsoft org membership (e.g., #574) are incorrectly treated as external.

Fix

Replace the single org check with a cascading multi-signal approach:

  1. microsoft-foundry org membership — full visibility via GITHUB_TOKEN
  2. Repo collaborator status — catches invited collaborators
  3. microsoft org membership — catches public members as fallback

Any positive signal → internal contributor.

Also adds members: read permission (for the collaborator check) and debug logging that shows which signal matched in the workflow run logs.

Testing

  • brandom-msft (microsoft-foundry member) → should match Signal 1 ✅
  • aahill (microsoft member, likely not in microsoft-foundry) → should match Signal 2 or 3
  • External contributors → no signal matches → external message
  • foundry-samples-repo-sync[bot] → skipped by bot allowlist

Replace the single 'microsoft' org membership check with a multi-signal
cascade that catches internal contributors with private org membership:

1. Check microsoft-foundry org membership (full GITHUB_TOKEN visibility)
2. Check repo collaborator status
3. Check microsoft org membership (public members fallback)

Also adds members: read permission and debug logging.

Fixes misidentification of internal contributors like #574 where a
Microsoft docs writer was incorrectly treated as an external contributor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

👋 Thanks for your contribution, @brandom-msft!

This repository is read-only. As a Microsoft contributor, please submit your PR to the private staging repository instead:

👉 foundry-samples-pr

See CONTRIBUTING.md for full instructions.

@github-actions github-actions bot closed this Mar 9, 2026
@brandom-msft brandom-msft reopened this Mar 9, 2026
@brandom-msft brandom-msft merged commit 99a8388 into main Mar 9, 2026
7 checks passed
brandom-msft added a commit that referenced this pull request Mar 10, 2026
The 'members: read' permission key added in #586 is not a valid
GitHub Actions permission, causing the workflow YAML to fail
validation. This broke auto-closing of PRs (#587, #588).

The repos.checkCollaborator API works with the default GITHUB_TOKEN
repo access — no extra permission is needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
brandom-msft added a commit that referenced this pull request Mar 10, 2026
The 'members: read' permission key added in #586 is not a valid
GitHub Actions permission, causing the workflow YAML to fail
validation. This broke auto-closing of PRs (#587, #588).

The repos.checkCollaborator API works with the default GITHUB_TOKEN
repo access — no extra permission is needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants