Skip to content

Add support for workflow run pending deployments#3538

Open
r1cksync wants to merge 1 commit into
PyGithub:mainfrom
r1cksync:add-pending-deployments
Open

Add support for workflow run pending deployments#3538
r1cksync wants to merge 1 commit into
PyGithub:mainfrom
r1cksync:add-pending-deployments

Conversation

@r1cksync

Copy link
Copy Markdown

This adds support for the GitHub Actions deployment protection rules API on WorkflowRun, which was previously not exposed by PyGithub.

What's added

  • WorkflowRun.get_pending_deployments()GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments. Returns the list of deployments for a run that are waiting on environment protection rules, as PendingDeployment objects.
  • WorkflowRun.review_pending_deployments(environment_ids, state, comment="")POST .../pending_deployments. Approves or rejects pending deployments for the given environments and returns the resulting Deployment objects.
  • New PendingDeployment class (NonCompletableGithubObject) exposing environment, wait_timer, wait_timer_started_at, current_user_can_approve and reviewers.

Tests

Two replay-based tests (testGetPendingDeployments, testReviewPendingDeployments) with hand-crafted fixtures cover both the GET and the POST paths, including reviewer parsing (User and Team) and the returned deployment objects. The full tests/WorkflowRun.py suite passes, and the changes are clean under black, ruff, isort, docformatter and codespell.

References

Add WorkflowRun.get_pending_deployments() and
WorkflowRun.review_pending_deployments() to support the GitHub Actions
deployment-protection-rules API, along with a new PendingDeployment
class and replay-based tests.
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.

1 participant