[PR #1928] [MERGED] fix: escape backticks and special chars in commit message for GitHub Action #5334

Closed
opened 2026-04-16 13:34:27 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/1928
Author: @Copilot
Created: 12/4/2025
Status: Merged
Merged: 12/4/2025
Merged by: @kolaente

Base: mainHead: copilot/fix-github-action-issue-closure


📝 Commits (2)

  • c50f060 Initial plan
  • b949b18 fix: escape backticks and special chars in commit message for GitHub Action

📊 Changes

1 file changed (+3 additions, -1 deletions)

View changed files

📝 .github/workflows/issue-closed-comment.yml (+3 -1)

📄 Description

The issue-closed-comment workflow fails when commit messages contain backticks because they're interpolated directly into JS template strings, breaking syntax.

Changes

  • Escape backslashes, backticks, and ${ sequences before setting the commit message output
  • Order matters: backslashes first to avoid interfering with subsequent escaping
// Before: raw message breaks template string if it contains backticks
core.setOutput('commit_message', commit.message);

// After: properly escaped for safe interpolation
const escapedMessage = commit.message.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
core.setOutput('commit_message', escapedMessage);
Original prompt

the github action which comments on issue closure fails when the commit message contains ` since these are js strings. Make sure to escape them.


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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/1928 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 12/4/2025 **Status:** ✅ Merged **Merged:** 12/4/2025 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `copilot/fix-github-action-issue-closure` --- ### 📝 Commits (2) - [`c50f060`](https://github.com/go-vikunja/vikunja/commit/c50f0600827c13fc6da486578fe0bac8e9837796) Initial plan - [`b949b18`](https://github.com/go-vikunja/vikunja/commit/b949b1869b47efd7a8d2f2d64ea7b2dea779d197) fix: escape backticks and special chars in commit message for GitHub Action ### 📊 Changes **1 file changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/issue-closed-comment.yml` (+3 -1) </details> ### 📄 Description The `issue-closed-comment` workflow fails when commit messages contain backticks because they're interpolated directly into JS template strings, breaking syntax. ### Changes - Escape backslashes, backticks, and `${` sequences before setting the commit message output - Order matters: backslashes first to avoid interfering with subsequent escaping ```javascript // Before: raw message breaks template string if it contains backticks core.setOutput('commit_message', commit.message); // After: properly escaped for safe interpolation const escapedMessage = commit.message.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$\{/g, '\\${'); core.setOutput('commit_message', escapedMessage); ``` <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > the github action which comments on issue closure fails when the commit message contains ` since these are js strings. Make sure to escape them. </details> <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/go-vikunja/vikunja/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 13:34:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#5334