-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
…)" This reverts commit ef385a9.
WalkthroughThe workflow for assigning an issue via a comment command in the GitHub Actions configuration was updated. The assignment step now uses a direct REST API call with Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GitHub Actions
participant GitHub API
User->>GitHub Actions: Comment triggers workflow
GitHub Actions->>GitHub API: POST /repos/{owner}/{repo}/issues/{issue_number}/assignees (assign issue)
GitHub API-->>GitHub Actions: Assignment result
Possibly related PRs
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/comment-commands.yml
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
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.
.github/workflows/comment-commands.yml (1)
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.
🪛 actionlint (1.7.7)
.github/workflows/comment-commands.yml
21-21: could not parse as YAML: yaml: line 21: mapping values are not allowed in this context
(syntax-check)
🪛 YAMLlint (1.37.1)
.github/workflows/comment-commands.yml
[error] 21-21: syntax error: mapping values are not allowed here
(syntax)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: Run snippets and cpython tests on wasm-wasi
- GitHub Check: Run rust tests (macos-latest)
- GitHub Check: Run tests under miri
- GitHub Check: Check Rust code with rustfmt and clippy
- GitHub Check: Check the WASM package and demo
- GitHub Check: Run snippets and cpython tests (ubuntu-latest)
- GitHub Check: Run rust tests (windows-latest)
- GitHub Check: Run snippets and cpython tests (windows-latest)
- GitHub Check: Run rust tests (ubuntu-latest)
- GitHub Check: Ensure compilation on various targets
- GitHub Check: Run snippets and cpython tests (macos-latest)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
After some debugging I got to scikit-learn/scikit-learn#29395 (comment)
Which, after running:
Returned:
So, I've switched it to use curl. now it should work for non maintainers as well
Summary by CodeRabbit