Skip to content

Make take issue comment to use curl #5937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/comment-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ jobs:
group: ${{ github.actor }}-issue-assign

permissions:
issues: write
issues: write

steps:
- run: gh issue edit "${{ env.ISSUE_NUMBER }}" --add-assignee "@${{ env.USER_LOGIN }}"
env:
ISSUE_NUMBER: ${{ github.event.issue.number }}
USER_LOGIN: ${{ github.event.comment.user.login }}
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
# Using REST API and not `gh issue edit`. https://github.com/cli/cli/issues/6235#issuecomment-1243487651
- run: curl \
-H "Authorization: token ${{ github.token }}" \
-d '{"assignees": ["${{ github.event.comment.user.login }}"]}' \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees
Comment on lines 18 to +23
Copy link
Contributor

@coderabbitai coderabbitai bot Jul 10, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Workflow fails to parse – convert the multi-line run script to a block scalar.

actionlint / yamllint correctly report a YAML syntax error because the multi-line curl command is written as a plain scalar; the embedded : in the header line is parsed as a new mapping key.
The job will never start.

-      - run: curl \
-          -H "Authorization: token ${{ github.token }}" \
-          -d '{"assignees": ["${{ github.event.comment.user.login }}"]}' \
-          https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees
+      - run: |
+          curl -sS \
+            -H "Authorization: token ${{ github.token }}" \
+            -H "Content-Type: application/json" \
+            -d "{\"assignees\": [\"${{ github.event.comment.user.login }}\"]}" \
+            "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees"

Block-scalar (|) formatting eliminates the syntax error and makes the script easier to read.
Adding -H "Content-Type: application/json" and quoting the URL are optional polish but keep the command self-contained.

🧰 Tools
🪛 actionlint (1.7.7)

21-21: could not parse as YAML: yaml: line 21: mapping values are not allowed in this context

(syntax-check)

🪛 YAMLlint (1.37.1)

[error] 21-21: syntax error: mapping values are not allowed here

(syntax)

🤖 Prompt for AI Agents
In .github/workflows/comment-commands.yml around lines 18 to 23, the multi-line
curl command under the run step is written as a plain scalar causing YAML syntax
errors due to unescaped colons. Convert the multi-line run script to use a block
scalar (|) to properly format the command as a literal block. Optionally, add
the header "Content-Type: application/json" and quote the URL string to improve
clarity and completeness.

Copy link
Contributor Author

@ShaharNaveh ShaharNaveh Jul 11, 2025

Choose a reason for hiding this comment

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

@coderabbitai can you open a PR with those changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

@ShaharNaveh I'll plan the code changes to fix the YAML syntax error in the workflow file. Another agent will execute these changes and create the PR for you.

Task: Fix YAML syntax error in comment-commands.yml

  • Convert multi-line curl command to use block scalar format
  • Add proper escaping and formatting
  • Include Content-Type header and quote URL for completeness

The changes will fix the YAML parsing error by using proper block scalar formatting, and I've included the Content-Type header and URL quoting for better clarity and completeness as suggested in my previous comment.


🧠 Learnings used
Learnt from: ShaharNaveh
PR: RustPython/RustPython#5932
File: .github/workflows/comment-commands.yml:18-24
Timestamp: 2025-07-10T10:08:43.304Z
Learning: In GitHub Actions workflows for the RustPython project, the maintainer ShaharNaveh prefers to keep workflows simple and doesn't mind if steps fail when the desired state is already achieved (e.g., user already assigned to an issue). Avoid suggesting complex error handling for edge cases they don't consider problematic.

⏳ Preparing changes...

Copy link
Contributor

Choose a reason for hiding this comment

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

A summary of the changes CodeRabbit can apply:

  • Fix the YAML syntax error in the GitHub Actions workflow by converting the multi-line curl command to block scalar format with proper indentation and escaping, ensuring correct parsing of the Authorization header.
  • ✅ Create PR with these edits
  • 📌 Create commit in current branch
  • 📋 Get copyable edits

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coderabbitai Create PR with these edits

Copy link
Contributor

Choose a reason for hiding this comment

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

Caution

CodeRabbit has failed to create the PR to execute your edits.

Copy link
Contributor Author

@ShaharNaveh ShaharNaveh Jul 11, 2025

Choose a reason for hiding this comment

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

@coderabbitai get me a copyable edit

Copy link
Contributor

Choose a reason for hiding this comment

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

Here are the copyable edits based on the planned changes:

Copyable Edits

.github/workflows/comment-commands.yml

@@ -17,7 +17,9 @@
 
    steps:
      # Using REST API and not `gh issue edit`. https://github.com/cli/cli/issues/6235#issuecomment-1243487651
-     - run: curl \
-         -H "Authorization: token ${{ github.token }}" \
-         -d '{"assignees": ["${{ github.event.comment.user.login }}"]}' \
-         https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees
+     - run: |
+         curl -sS \
+           -H "Authorization: token ${{ github.token }}" \
+           -H "Content-Type: application/json" \
+           -d "{"assignees": ["${{ github.event.comment.user.login }}"]}" \
+           "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees"
  • ✅ Create PR with these edits
  • 📌 Create commit in current branch

Loading