Skip to content

introduce validation workflow for PR project assignment#3334

Draft
ranshid wants to merge 1 commit intovalkey-io:unstablefrom
ranshid:force-pr-project-assign
Draft

introduce validation workflow for PR project assignment#3334
ranshid wants to merge 1 commit intovalkey-io:unstablefrom
ranshid:force-pr-project-assign

Conversation

@ranshid
Copy link
Member

@ranshid ranshid commented Mar 9, 2026

Add CI check for project assignment on PRs

This adds a GitHub Actions workflow that verifies every PR targeting unstable has at least one GitHub Project assigned before it can be merged.
this is to ensure PRs are properly tracked in a project before merging, improving visibility and project management.

What it does

  • Runs on PRs targeting the unstable branch in valkey-io/valkey
  • Uses the GitHub API to check if the PR has any associated project
  • Fails with a clear error if no project is assigned

@ranshid ranshid added the major-decision-pending Major decision pending by TSC team label Mar 9, 2026
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.06%. Comparing base (fc217fc) to head (859971b).
⚠️ Report is 26 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #3334      +/-   ##
============================================
+ Coverage     75.05%   75.06%   +0.01%     
============================================
  Files           129      129              
  Lines         71553    71632      +79     
============================================
+ Hits          53705    53774      +69     
- Misses        17848    17858      +10     

see 22 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

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

Adds a GitHub Actions workflow to enforce that pull requests targeting the unstable branch in valkey-io/valkey are assigned to at least one GitHub Project before merging, improving PR tracking.

Changes:

  • Introduces a new pull_request_target workflow scoped to PRs targeting unstable.
  • Uses gh api graphql to query the PR’s associated Project items and fails the check if none are found.

You can also share your feedback on Copilot code review. Take the survey.

- unstable

permissions:
pull-requests: read
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

permissions: is restricted to pull-requests: read, which sets all other token permissions to none. The GraphQL field pullRequest.projectItems requires Projects access, so this workflow is likely to fail with authorization errors. Add projects: read (and, if you also need classic projects support, repository-projects: read) to the workflow permissions.

Suggested change
pull-requests: read
pull-requests: read
projects: read
repository-projects: read

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +37
run: |
PROJECT_COUNT=$(gh api graphql -f query='
query($owner: String!, $repo: String!, $pr: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr) {
projectItems(first: 1) {
totalCount
}
}
}
}' -f owner="$REPO_OWNER" -f repo="$REPO_NAME" -F pr="$PR_NUMBER" \
--jq '.data.repository.pullRequest.projectItems.totalCount')

if [ "$PROJECT_COUNT" -eq 0 ]; then
echo "::error::This PR has no assigned project. Please add it to a project before merging."
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

The script doesn’t run in a strict shell mode and doesn’t handle gh api failures explicitly. If the API call fails (auth/network/GraphQL error), PROJECT_COUNT may be empty and the numeric comparison will error with a confusing message. Consider enabling strict mode (e.g., set -euo pipefail) and failing with a clear ::error::... when the API call doesn’t return a number.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +7
on:
pull_request_target:
types: [opened, edited, reopened, synchronize]
branches:
- unstable
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

This workflow won’t automatically rerun when a PR is added to/removed from a GitHub Project (that change doesn’t emit a pull_request(_target) event type). That means a PR can remain in a failing “required check” state until someone manually re-runs the workflow or pushes a new commit. Consider adding a workflow_dispatch trigger (or documenting the required re-run) to reduce friction.

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

major-decision-pending Major decision pending by TSC team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants