Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

The github-discussion-query safe-input tool was failing in smoke tests because gh discussion list doesn't exist in GitHub Actions runners. The CLI only supports gh issue, gh pr, gh api, etc.

Changes

Replaced CLI command with GraphQL API

Before:

OUTPUT=$(gh discussion list --limit "$LIMIT" --json "$JSON_FIELDS" --repo "$REPO")

After:

# Parse repo owner/name, build GraphQL query
GRAPHQL_QUERY=$(cat <<QUERY
{
  repository(owner: "$OWNER", name: "$NAME") {
    discussions(first: $LIMIT, orderBy: {field: CREATED_AT, direction: DESC}) {
      nodes { number, title, author { login }, ... }
    }
  }
}
QUERY
)

# Execute and transform to match expected format
GRAPHQL_OUTPUT=$(gh api graphql -f query="$GRAPHQL_QUERY")
OUTPUT=$(echo "$GRAPHQL_OUTPUT" | jq '[.data.repository.discussions.nodes[] | {...}]')

Files Modified

  • .github/workflows/shared/github-queries-safe-input.md - Shared safe-input definition
  • .github/workflows/daily-performance-summary.md - Inline override that was shadowing the shared definition
  • Recompiled 6 workflow lock files (smoke-claude, smoke-codex, smoke-copilot, smoke-opencode, daily-regulatory, daily-performance-summary)

The GraphQL output is transformed to match the original flat array format, maintaining backward compatibility with existing jq filters in workflows.

Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/21259455291/job/61183011824

Debug explain why the discussion-comment task failed in this run. The agent was supposed to post a comment on a discussion, but it failed. Inspect the logs using the audit tool.

Custom agent used: agentic-workflows
GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits January 22, 2026 18:21
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Replace gh discussion list (unsupported) with gh api graphql.
The gh CLI in GitHub Actions doesn't have a 'discussion' subcommand,
so we use the GraphQL API to query discussions instead.

- Parse repo owner/name from INPUT_REPO or GitHub context
- Build GraphQL query for discussions with proper fields
- Transform GraphQL output to match expected format
- Maintains backward compatibility with existing jq filters

Fixes discussion-comment task failure in smoke tests.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Recompile all workflows that import shared/github-queries-safe-input.md
to apply the GraphQL API fix for discussion queries.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
The daily-performance-summary.md workflow had an inline definition of
github-discussion-query that overrides the shared import. Updated the
inline definition to also use GraphQL API.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate failure of discussion comment posting task Fix github-discussion-query to use GraphQL API instead of non-existent gh discussion command Jan 22, 2026
Copilot AI requested a review from pelikhan January 22, 2026 18:36
@pelikhan pelikhan marked this pull request as ready for review January 22, 2026 18:49
@pelikhan pelikhan merged commit 9a35946 into copilot/update-smoke-agentic-workflows Jan 22, 2026
@pelikhan pelikhan deleted the copilot/debug-discussion-comment-failure branch January 22, 2026 18:49
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