Skip to content

Allow remote dispatch#94

Open
karangattu wants to merge 2 commits intomainfrom
allow-remote-dispatch
Open

Allow remote dispatch#94
karangattu wants to merge 2 commits intomainfrom
allow-remote-dispatch

Conversation

@karangattu
Copy link
Copy Markdown

This pull request updates the GitHub Actions workflows to improve automation around pull request reviews and scheduled checks. The main changes are the addition of a new workflow to automatically request a maintainer review for certain pull requests, and the removal of a scheduled trigger from the R CMD check workflow.

Workflow automation improvements:

  • Added a new workflow file, copilot-pr-review-request.yaml, which automatically requests a review from the maintainer (schloerke) when a pull request is opened, reopened, or marked ready for review by the copilot-swe-agent user, provided the PR is not a draft. This helps streamline the review process for PRs created by the Copilot agent.

Changes to scheduled checks:

  • Removed the scheduled weekly trigger from the R-CMD-check.yaml workflow, so it will no longer run automatically every Monday. The workflow can still be triggered manually or by pull requests and branch updates.

Replace the weekly cron schedule with workflow_dispatch to allow manual/remote triggering. Adds a comment indicating the workflow is triggered remotely from rstudio/shinycoreci; existing branch and pull_request triggers remain unchanged.
Add a GitHub Actions workflow that triggers on pull_request_target (opened, reopened, ready_for_review). When a PR is authored by a user whose login starts with 'copilot-swe-agent' and is not a draft, the job uses the GitHub CLI to request reviewer 'schloerke' (after checking if they are already requested). Grants pull-requests: write permission and uses GH_TOKEN for authentication.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates GitHub Actions automation to streamline maintainer review requests for Copilot-created PRs and to shift package checks away from a fixed weekly schedule toward manual/remote triggering.

Changes:

  • Added a pull_request_target workflow to auto-request a maintainer review on certain PR events.
  • Removed the weekly scheduled trigger from the R CMD check workflow and added workflow_dispatch.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/copilot-pr-review-request.yaml New workflow that requests a maintainer review for PRs authored by the Copilot SWE agent.
.github/workflows/R-CMD-check.yaml Removes weekly cron scheduling; keeps PR/push triggers and adds manual dispatch support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


jobs:
request-maintainer-review:
if: startsWith(github.event.pull_request.user.login, 'copilot-swe-agent') && !github.event.pull_request.draft
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The job condition uses startsWith(..., 'copilot-swe-agent'), which would also match any other account whose username begins with that prefix (e.g. copilot-swe-agent-foo). Since this workflow runs on pull_request_target with elevated GITHUB_TOKEN permissions, it should be restricted to an exact allowed actor/login (or a small explicit allow-list) to avoid unintended triggering/spam.

Suggested change
if: startsWith(github.event.pull_request.user.login, 'copilot-swe-agent') && !github.event.pull_request.draft
if: github.event.pull_request.user.login == 'copilot-swe-agent' && !github.event.pull_request.draft

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +29
requested_reviewers="$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${GITHUB_REPOSITORY}/pulls/${PULL_NUMBER}/requested_reviewers" \
--jq '.users[].login' || true)"
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

requested_reviewers swallows any failure from the gh api call (|| true) even though set -euo pipefail is enabled. This can hide real problems (missing permissions, API outage) and lead to confusing behavior (always attempting to request the reviewer). Consider handling errors explicitly (e.g., check exit status and log a clear message, or fail the job) rather than unconditionally ignoring them.

Suggested change
requested_reviewers="$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${GITHUB_REPOSITORY}/pulls/${PULL_NUMBER}/requested_reviewers" \
--jq '.users[].login' || true)"
if ! requested_reviewers="$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${GITHUB_REPOSITORY}/pulls/${PULL_NUMBER}/requested_reviewers" \
--jq '.users[].login')"; then
echo "Failed to fetch requested reviewers for pull request ${PULL_NUMBER}." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
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