-
Notifications
You must be signed in to change notification settings - Fork 1
Add .cursorrules file for project documentation and enhance workflow … #22
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
…routes with URL encoding filter - Introduced a new .cursorrules file containing comprehensive project documentation, including environment setup, project structure, and deployment instructions. - Added a URL encoding filter to Jinja2 templates to ensure proper encoding of query parameters in links. - Updated workflow routes to preserve 'ref' and 'inputs' in the 'Try again' and 'Run again' links on the result page. - Enhanced test coverage for the result page to verify preservation of 'ref' and 'inputs' in links.
|
✅ Tests completed successfully!
|
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.
Pull request overview
This PR enhances the workflow trigger functionality to preserve query parameters (ref and workflow inputs) in result page links, ensuring users can easily re-run workflows with the same configuration. It also adds comprehensive documentation via a .cursorrules file and introduces URL encoding capabilities for Jinja2 templates.
- Added URL encoding filter to Jinja2 templates to handle special characters in query parameters
- Modified result page templates to preserve
refand workflow input parameters in "Run again" and "Try again" links - Updated backend routes to pass
refandinputsto result templates in both success and error scenarios - Enhanced test coverage with three new tests verifying parameter preservation and URL encoding functionality
- Introduced comprehensive project documentation in
.cursorrulesfile
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| backend/routes/workflow.py | Added urlencode filter for Jinja2, updated error handling to pass ref and inputs to result template |
| frontend/templates/result.html | Modified "Run again" and "Try again" links to include ref and inputs query parameters with URL encoding |
| tests/test_app.py | Added tests for parameter preservation in result pages and urlencode filter functionality |
| .cursorrules | Added comprehensive project documentation including setup, structure, commands, and deployment instructions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| </a> | ||
| {% endif %} | ||
| <a href="/?owner={{ owner }}&repo={{ repo }}{% if workflow_id %}&workflow_id={{ workflow_id }}{% endif %}" class="btn btn-secondary"> | ||
| <a href="/?owner={{ owner }}&repo={{ repo }}{% if workflow_id %}&workflow_id={{ workflow_id }}{% endif %}{% if ref %}&ref={{ ref }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary"> |
Copilot
AI
Nov 26, 2025
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.
The loop variable key in the URL construction is not URL-encoded. If workflow input parameter names contain special characters (e.g., spaces, ampersands), this could result in malformed URLs. Consider applying the urlencode filter to the key as well:
&{{ key|urlencode }}={{ value|urlencode }}| <div class="action-links"> | ||
| {% if owner and repo and workflow_id %} | ||
| <a href="/?owner={{ owner }}&repo={{ repo }}&workflow_id={{ workflow_id }}" class="btn btn-secondary"> | ||
| <a href="/?owner={{ owner }}&repo={{ repo }}&workflow_id={{ workflow_id }}{% if ref %}&ref={{ ref }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary"> |
Copilot
AI
Nov 26, 2025
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.
The loop variable key in the URL construction is not URL-encoded. If workflow input parameter names contain special characters (e.g., spaces, ampersands), this could result in malformed URLs. Consider applying the urlencode filter to the key as well:
&{{ key|urlencode }}={{ value|urlencode }}| <a href="/?owner={{ owner }}&repo={{ repo }}&workflow_id={{ workflow_id }}{% if ref %}&ref={{ ref }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary"> | |
| <a href="/?owner={{ owner }}&repo={{ repo }}&workflow_id={{ workflow_id }}{% if ref %}&ref={{ ref }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key|urlencode }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary"> |
| </a> | ||
| {% endif %} | ||
| <a href="/?owner={{ owner }}&repo={{ repo }}{% if workflow_id %}&workflow_id={{ workflow_id }}{% endif %}" class="btn btn-secondary"> | ||
| <a href="/?owner={{ owner }}&repo={{ repo }}{% if workflow_id %}&workflow_id={{ workflow_id }}{% endif %}{% if ref %}&ref={{ ref }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary"> |
Copilot
AI
Nov 26, 2025
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.
The owner, repo, workflow_id, and ref parameters in the URL are not URL-encoded, which could cause issues if they contain special characters (e.g., spaces, ampersands). Consider applying the urlencode filter to these variables as well:
<a href="/?owner={{ owner|urlencode }}&repo={{ repo|urlencode }}{% if workflow_id %}&workflow_id={{ workflow_id|urlencode }}{% endif %}{% if ref %}&ref={{ ref|urlencode }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary">| <div class="action-links"> | ||
| {% if owner and repo and workflow_id %} | ||
| <a href="/?owner={{ owner }}&repo={{ repo }}&workflow_id={{ workflow_id }}" class="btn btn-secondary"> | ||
| <a href="/?owner={{ owner }}&repo={{ repo }}&workflow_id={{ workflow_id }}{% if ref %}&ref={{ ref }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary"> |
Copilot
AI
Nov 26, 2025
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.
The owner, repo, workflow_id, and ref parameters in the URL are not URL-encoded, which could cause issues if they contain special characters (e.g., spaces, ampersands). Consider applying the urlencode filter to these variables as well:
<a href="/?owner={{ owner|urlencode }}&repo={{ repo|urlencode }}&workflow_id={{ workflow_id|urlencode }}{% if ref %}&ref={{ ref|urlencode }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary">| <a href="/?owner={{ owner }}&repo={{ repo }}&workflow_id={{ workflow_id }}{% if ref %}&ref={{ ref }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary"> | |
| <a href="/?owner={{ owner|urlencode }}&repo={{ repo|urlencode }}&workflow_id={{ workflow_id|urlencode }}{% if ref %}&ref={{ ref|urlencode }}{% endif %}{% if inputs %}{% for key, value in inputs.items() %}{% if value %}&{{ key }}={{ value|urlencode }}{% endif %}{% endfor %}{% endif %}" class="btn btn-secondary"> |
|
|
||
| def test_result_page_preserves_ref_and_inputs(client, mock_session): | ||
| """Test that result page preserves ref and inputs in 'Try again' links""" | ||
| from unittest.mock import patch, Mock, AsyncMock |
Copilot
AI
Nov 26, 2025
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.
The Mock import is unused in this test function. It can be removed from the import statement.
| from unittest.mock import patch, Mock, AsyncMock | |
| from unittest.mock import patch, AsyncMock |
|
|
||
| def test_result_page_success_preserves_ref_and_inputs(client, mock_session): | ||
| """Test that successful result page preserves ref and inputs in 'Run again' links""" | ||
| from unittest.mock import patch, Mock, AsyncMock |
Copilot
AI
Nov 26, 2025
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.
The Mock import is unused in this test function. It can be removed from the import statement.
| from unittest.mock import patch, Mock, AsyncMock | |
| from unittest.mock import patch, AsyncMock |
- Extracted return_url from query parameters and form data to allow for better navigation after workflow triggers. - Updated relevant functions and templates to include return_url, ensuring it is passed through API calls and displayed correctly in the UI. - Modified the index and result templates to conditionally render the return_url link for improved user experience.
- Introduced a new set of scripts for generating GitHub Actions workflow trigger badges, including `generate_badges.py` and `generate_markdown.py`. - Added a comprehensive README for the badge generator, detailing usage, configuration, and examples. - Created JSON configuration files for badge settings and examples, enabling easy customization and integration into workflows. - Implemented a preview script to visualize badge configurations as markdown. - Updated the GitHub Actions workflow to utilize the new badge generation scripts for PR comments.
- Added functionality to load branches from a specified file for badge generation, allowing for dynamic branch selection. - Introduced a new configuration option for badges to create only UI badges, enhancing customization for users. - Updated the badge configuration JSON to include a new badge type for manual branch selection and a custom backport badge with UI support.
…routes with URL encoding filter