Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 4, 2026

Add Support for Missing GitHub Projects V2 Field Types

Problem Statement

After analyzing the campaign run at https://github.com/githubnext/gh-aw/actions/runs/20691544012/job/59400706868, I identified that the update_project.cjs file only supported 3 field types (DATE, SINGLE_SELECT, TEXT), while GitHub Projects V2 supports additional field types including NUMBER and ITERATION that were not handled.

Solution Implemented

Complete Implementation - All tasks completed successfully.

Changes Made

1. GraphQL Query Enhancement

  • Added ProjectV2IterationField fragment to fetch iteration configurations
  • Added ProjectV2DateField fragment to properly fetch DATE fields (fix for issue where DATE fields weren't being applied)
  • Retrieves iteration ID, title, startDate, and duration for matching

2. NUMBER Field Type Support

  • Accepts numeric values directly
  • Converts string values to numbers using parseFloat()
  • Validates input and provides clear warnings for invalid values
  • Uses correct GraphQL mutation format: { number: <value> }

3. ITERATION Field Type Support

  • Matches iterations by title (case-insensitive)
  • Looks up iteration IDs from field configuration
  • Provides helpful warnings listing available iterations when match fails
  • Uses correct GraphQL mutation format: { iterationId: <id> }

4. DATE Field Type Support (Fixed)

  • Added explicit ProjectV2DateField fragment to GraphQL queries
  • GitHub's GraphQL API requires specific field type fragments to properly return field data
  • Without the fragment, DATE fields may not be properly identified in the query results

5. Comprehensive Test Coverage

  • Added 7 new test cases covering all scenarios
  • Tests for numeric values, string conversion, invalid input handling
  • Tests for iteration matching, case-insensitivity, and error cases
  • All 30 tests pass (23 existing + 7 new)

6. Documentation Updates

  • Added "Supported Field Types" section to safe-outputs reference
  • Documented all 5 supported types with examples
  • Included clear usage examples for each field type
  • Added note about case-insensitive field name matching

Root Cause of DATE Field Issue

The GraphQL query was missing the ProjectV2DateField fragment. While ProjectV2Field is the base type, GitHub's GraphQL API requires explicit fragments for specialized field types:

  • ProjectV2Field - Base type (includes id, name, dataType)
  • ProjectV2DateField - Required for DATE fields to be properly identified
  • ProjectV2SingleSelectField - Required for dropdown fields
  • ProjectV2IterationField - Required for iteration fields

Without the ProjectV2DateField fragment, DATE fields were not being returned in query results, causing start_date and end_date to be ignored.

Validation Results

GraphQL Queries - Now include all required field type fragments
Field Type Handling - Correct mutation formats for NUMBER, ITERATION, and DATE
Backward Compatibility - No breaking changes, existing tests pass
Code Quality - Formatting and linting validated
Error Handling - Clear warnings for invalid input
Test Coverage - 100% pass rate on all 30 tests

Files Changed

  1. actions/setup/js/update_project.cjs (+62 lines, -3 lines)
  2. actions/setup/js/update_project.test.cjs (+205 lines)
  3. docs/src/content/docs/reference/safe-outputs.md (+25 lines)

Supported Field Types

The update_project safe output now supports:

  • TEXT - Text fields (default)
  • DATE - Date fields (YYYY-MM-DD format) - NOW FIXED
  • NUMBER - Numeric fields (story points, estimates)
  • ITERATION - Sprint/iteration fields (matched by title)
  • SINGLE_SELECT - Dropdown fields (auto-creates options)
Original prompt

Analyze campaign run to understand which field types are missing/not supported.
https://github.com/githubnext/gh-aw/actions/runs/20691544012/job/59400706868
Add support for them.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Analyze campaign run and add support for missing field types Add support for NUMBER and ITERATION field types in update-project Jan 4, 2026
Copilot AI requested a review from mnkiefer January 4, 2026 11:09
@mnkiefer
Copy link
Contributor

mnkiefer commented Jan 4, 2026

@copilot: Why were start_date and end_date fields never applied in the safe outputs step even though the agent discovered and added them?

Copy link
Contributor Author

Copilot AI commented Jan 4, 2026

@copilot: Why were start_date and end_date fields never applied in the safe outputs step even though the agent discovered and added them?

The GraphQL query was missing the ProjectV2DateField fragment. GitHub's GraphQL API requires explicit fragments for specialized field types - without it, DATE fields weren't being returned in query results.

Fixed in commit 5488869 by adding ProjectV2DateField fragment to both field queries. The fragment includes id, name, and dataType, allowing DATE fields like start_date and end_date to be properly identified and applied.

@mnkiefer mnkiefer marked this pull request as ready for review January 4, 2026 11:19
@mnkiefer
Copy link
Contributor

mnkiefer commented Jan 4, 2026

@copilot: Recompile workflows.

Copy link
Contributor Author

Copilot AI commented Jan 4, 2026

@copilot: Recompile workflows.

Workflows recompiled successfully. All 122 workflow files validated and compiled. No changes were needed - the compiled .lock.yml files were already up to date with the JavaScript changes in actions/setup/js/update_project.cjs.

@mnkiefer mnkiefer merged commit 685aca7 into main Jan 4, 2026
89 of 92 checks passed
@mnkiefer mnkiefer deleted the copilot/add-support-for-missing-field-types branch January 4, 2026 11:35
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