Skip to content

Conversation

Copy link

Copilot AI commented Jan 19, 2026

Teamwork's UI locks comments to private and clears notification lists when comments are marked private. This breaks the reset comment workaround and affects manual comments added after automated ones.

Changes

New functions:

  • teamwork::get_custom_field_id() - Looks up custom field ID by name using v3 API
  • teamwork::update_task_custom_field() - Updates task custom field value via v1 API

Modified event handlers:

  • pull_request_opened - Sets "PR" custom field to PR URL (was: private comment)
  • pull_request_closed - Updates field with "(Merged)" or "(Closed)" suffix
  • pull_request_review_submitted - Adds tags only (was: comment + tags)
  • pull_request_review_dismissed - No action (was: comment)

Removed:

  • teamwork::add_reset_comment() and all reset comment logic
  • Comment generation for PR events
  • Variables only used for comment formatting

Implementation notes

Custom field values properly escape JSON and URL-encode query parameters:

# Field lookup with URL encoding
local -r encoded_field_name=$(printf %s "$field_name" | jq -sRr @uri)
curl "$TEAMWORK_URI/projects/api/v3/customfields.json?searchTerm=$encoded_field_name"

# Update with safe JSON construction
local -r json_payload=$(jq -n \
  --arg field_value "$field_value" \
  --argjson custom_field_id "$custom_field_id" \
  '{"todo-item": {"customFields": [{"customFieldId": $custom_field_id, "value": $field_value}]}}')

Requires a custom field named "PR" to exist on tasks. Tags and board column movement unchanged.

Original prompt

Read the Teamwork API Docs: https://apidocs.teamwork.com/guides/teamwork/getting-started-with-the-teamwork-com-api

The current workflow doesn't work as we'd like it to. There's a UI state the locks the comments to private and having removed the people who should be notified of the comments. Adjust the implementation to bind the PR and the Task together in another way - maybe a custom field? One already exists on our tasks called "PR". However, this


💡 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.

Copilot AI and others added 2 commits January 19, 2026 08:33
- Add functions to get custom field ID by name and update task custom fields
- Update PR workflows to use custom field "PR" instead of adding comments
- Remove comment-based tracking which was causing UI state issues
- Update documentation to reflect custom field integration
- Clean up unused variables to pass shellcheck
- All test scenarios pass successfully

Co-authored-by: andre-olsen <107027473+andre-olsen@users.noreply.github.com>
- URL encode field_name parameter in API query to handle special characters
- Use jq to properly construct JSON payload to escape field_value safely
- Remove trailing whitespace for consistency
- All tests still passing

Co-authored-by: andre-olsen <107027473+andre-olsen@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix comment notification locking in Task management Replace comment-based task binding with custom field integration Jan 19, 2026
Copilot AI requested a review from andre-olsen January 19, 2026 08:37
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