Skip to content

[wrangler] Open Container shells without SSH keys #21952

[wrangler] Open Container shells without SSH keys

[wrangler] Open Container shells without SSH keys #21952

Workflow file for this run

name: "Code Owners"
# Re-evaluate when PRs are opened/updated.
# When reviews are submitted/dismissed, the separate rerun-codeowners.yml workflow
# re-runs this check (rather than creating a second check context).
# Using pull_request_target (not pull_request) so the workflow has access to secrets
# for fork PRs. This is safe because:
# - GitHub runs the workflow from the base repository's default branch
# - PR head commits are fetched as git objects only (never checked out or executed)
# - The action reads ownership rules from the PR base commit and calls the GitHub API
on:
pull_request_target: # zizmor: ignore[dangerous-triggers] checks base branch ownership rules and fetches PR head for diff computation without executing PR code
types: [opened, edited, reopened, synchronize, ready_for_review]
concurrency:
group: codeowners-${{ github.event.pull_request.number }}
cancel-in-progress: ${{ !(github.event.pull_request.user.login == 'workers-devprod' && github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.head_ref, 'changeset-release/')) }}
permissions:
contents: read
issues: write
pull-requests: write
jobs:
codeowners:
name: "Run Codeowners Plus"
runs-on: ubuntu-latest
# Skip evaluation for workers-devprod release PRs from this repository only.
# Running on every other PR supports stacks regardless of parent PR creation
# order.
steps:
- name: "Checkout Base Branch"
if: ${{ !(github.event.pull_request.user.login == 'workers-devprod' && github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.event.pull_request.head.ref, 'changeset-release/')) }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- name: "Fetch PR Head (for diff computation)"
if: ${{ !(github.event.pull_request.user.login == 'workers-devprod' && github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.event.pull_request.head.ref, 'changeset-release/')) }}
run: git fetch origin +refs/pull/${{ github.event.pull_request.number }}/head
env:
GITHUB_TOKEN: "${{ secrets.CODEOWNERS_GITHUB_PAT }}"
- name: "Codeowners Plus"
id: codeowners
if: ${{ !(github.event.pull_request.user.login == 'workers-devprod' && github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.event.pull_request.head.ref, 'changeset-release/')) }}
uses: multimediallc/codeowners-plus@ff02aa993a92e8efe01642916d0877beb9439e9f # v1.9.0
with:
github-token: "${{ secrets.CODEOWNERS_GITHUB_PAT }}"
pr: "${{ github.event.pull_request.number }}"
verbose: true
quiet: ${{ github.event.pull_request.draft }}
# Codeowners Plus only withdraws its own approval when smart dismissal is
# enabled, and codeowners.toml disables that so human approvals survive
# new pushes. Without this step, an approval the bot gave earlier (e.g.
# while the PR briefly had no diff) stays valid after changes that need
# codeowner review are pushed.
- name: "Dismiss Stale Bot Approval"
if: ${{ steps.codeowners.outcome == 'success' && !fromJSON(steps.codeowners.outputs.data).success }}
env:
GH_TOKEN: "${{ secrets.CODEOWNERS_GITHUB_PAT }}"
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
bot_login=$(gh api user --jq .login)
review_ids=$(gh api --paginate "repos/${REPO}/pulls/${PR_NUMBER}/reviews" \
--jq ".[] | select(.state == \"APPROVED\" and .user.login == \"${bot_login}\") | .id")
for review_id in $review_ids; do
gh api --method PUT "repos/${REPO}/pulls/${PR_NUMBER}/reviews/${review_id}/dismissals" \
-f message="Codeowners reviews no longer satisfied" -f event=DISMISS
echo "Dismissed approval ${review_id} from ${bot_login}"
done