Skip to content

Conversation

@naspirato
Copy link
Owner

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

…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.
@naspirato naspirato requested a review from Copilot November 26, 2025 15:59
@github-actions
Copy link

github-actions bot commented Nov 26, 2025

🚀 Quick Actions

🧪 Run Tests

Test Type Actions
All ▶ Run All ⚙️
Unit ▶ Run Unit ⚙️
Integration ▶ Run Integration ⚙️

📦 Backport

Branch Actions
release/v1.0 ▶ Backport ⚙️
release/v2.0 ▶ Backport ⚙️
stable ▶ Backport ⚙️

Choose branches to backport manually:

⚙️ Backport (Custom)

▶ - immediately runs the workflow with default parameters.

⚙️ - opens UI to review and modify parameters before running.


These links will automatically comment on this PR with the workflow results.

Tip: To open links in a new tab, use Ctrl+Click (Windows/Linux) or Cmd+Click (macOS).

@github-actions
Copy link

Tests completed successfully!

  • Test type: all
  • Workflow run: View run
  • Status: ✅ Success

Copy link

Copilot AI left a 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 ref and workflow input parameters in "Run again" and "Try again" links
  • Updated backend routes to pass ref and inputs to 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 .cursorrules file

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">
Copy link

Copilot AI Nov 26, 2025

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 }}

Copilot uses AI. Check for mistakes.
<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">
Copy link

Copilot AI Nov 26, 2025

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 }}
Suggested change
<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">

Copilot uses AI. Check for mistakes.
</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">
Copy link

Copilot AI Nov 26, 2025

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">

Copilot uses AI. Check for mistakes.
<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">
Copy link

Copilot AI Nov 26, 2025

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">
Suggested change
<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">

Copilot uses AI. Check for mistakes.

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
Copy link

Copilot AI Nov 26, 2025

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.

Suggested change
from unittest.mock import patch, Mock, AsyncMock
from unittest.mock import patch, AsyncMock

Copilot uses AI. Check for mistakes.

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
Copy link

Copilot AI Nov 26, 2025

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.

Suggested change
from unittest.mock import patch, Mock, AsyncMock
from unittest.mock import patch, AsyncMock

Copilot uses AI. Check for mistakes.
- 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.
@naspirato naspirato merged commit f783b3b into main Nov 26, 2025
1 check passed
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.

1 participant