Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 15, 2025

This PR adds support for clearing field values in GitHub Projects using the new clear operation, which leverages GitHub's clearProjectV2ItemFieldValue GraphQL mutation.

Problem

Currently, there's no way to clear Date fields (or other field types) in GitHub Projects using this action. Users needed a way to remove values from fields, particularly Date fields, but the existing update operation only allows setting values, not clearing them.

Solution

Added a new clear operation that uses the ClearProjectV2ItemFieldValueInput GraphQL mutation to clear field values.

Key Changes:

  • New clearField() function: Implements the clearProjectV2ItemFieldValue GraphQL mutation
  • Enhanced input validation: Updated getInputs() to accept "clear" as a valid operation alongside "read" and "update"
  • Extended main workflow: Enhanced run() function to handle clear operations with appropriate logging
  • Comprehensive test coverage: Added 3 new tests covering input validation, field clearing, and end-to-end operation
  • Updated documentation: Enhanced action.yml and README.md with clear operation details and usage examples

Usage Example:

- name: Clear due date
  uses: github/update-project-action@v3
  with:
    github_token: ${{ secrets.TOKEN }}
    organization: github
    project_number: 1234
    content_id: ${{ github.event.issue.node_id }}
    field: "Due Date"
    operation: clear

Backwards Compatibility

This change is fully backwards compatible. Existing workflows using read and update operations continue to work exactly as before. The clear operation is purely additive.

Testing

  • All new functionality is covered by tests
  • Existing tests continue to pass (4 pre-existing test failures are unrelated to this change)
  • Code follows project linting and formatting standards

Fixes #144.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add clearField function using ClearProjectV2ItemFieldValueInput GraphQL mutation
- Update getInputs to accept "clear" as valid operation
- Update run function to handle clear operation
- Add comprehensive tests for clear functionality
- Update action.yml and README.md documentation
- Maintain backwards compatibility with existing operations

Co-authored-by: benbalter <[email protected]>
Copilot AI changed the title [WIP] Feature request: clear field value support Add support for clearing field values with new "clear" operation Aug 15, 2025
Copilot AI requested a review from benbalter August 15, 2025 18:10
Copilot finished work on behalf of benbalter August 15, 2025 18:10
@benbalter benbalter marked this pull request as ready for review August 15, 2025 22:09
Copilot AI review requested due to automatic review settings August 15, 2025 22:09
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

This PR adds support for clearing field values in GitHub Projects by introducing a new "clear" operation that uses the clearProjectV2ItemFieldValue GraphQL mutation.

  • Added a new clearField() function to execute field clearing operations
  • Enhanced input validation to accept "clear" as a valid operation type
  • Updated the main workflow to handle clear operations with appropriate logging and output

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
src/update-project.ts Implements the core clearField() function and integrates clear operation into input validation and main workflow
action.yml Updates operation description to include "clear" option
test/main.test.ts Adds comprehensive test coverage for clear operation input validation, function behavior, and end-to-end workflow
README.md Updates documentation with clear operation usage examples and corrects parameter descriptions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Co-authored-by: Copilot <[email protected]>
@benbalter benbalter merged commit 90ee086 into main Aug 15, 2025
4 checks passed
@benbalter benbalter deleted the copilot/fix-144 branch August 15, 2025 22:13
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.

Feature request: clear field value support

2 participants