cmake_template
cmake_template copied to clipboard
fix: safely replace description placeholder in janitor run
Before this commit a (single-)quote or the pipe symbol in the description would make the janitor fail to replace the description placeholder as those made the sed statement malformed.
A first fix is to store the value of the description in a variable and pass that to the sed statement. This eliminates the problems of quotes and variable expansion due to $ signs. The variable had to be passed as a real variable instead of using githubs variable replacement as with that the shell would still see the quotes and parse them.
The second thing to fix is to escape any occurences of the pipe symbol in the description as that is what the sed command uses as its delimiter. The escaping has to be done by adding a literal \ to the description so during the sed command the | will stay in place. While doing this it became clear that also the \ has to be escaped as it would otherwise vanish after the sed run. Thus this is done prior to escaping the pipe symbol in order to not also mess with the introduced \ in that command.
To verify it is working the test step gained a new variable that is injected if the it is no new repo. With this at least it is checked that the description can contain the special characters. One thing to note though is that setting the test variable and extracting the actual description need to look alike so we can be sure the actual retrieval will not fail.
fixes #114
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 20.50%. Comparing base (
1015c6b) to head (e12e9e4).
Additional details and impacted files
@@ Coverage Diff @@
## main #116 +/- ##
=======================================
Coverage 20.50% 20.50%
=======================================
Files 5 5
Lines 239 239
Branches 112 109 -3
=======================================
Hits 49 49
- Misses 179 181 +2
+ Partials 11 9 -2
| Flag | Coverage Δ | |
|---|---|---|
| Linux | 17.64% <ø> (ø) |
|
| Windows | 21.02% <ø> (ø) |
|
| macOS | 18.09% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.