Skip to content
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

Some chars need to be escaped #349

Open
Goooler opened this issue Jun 30, 2024 · 3 comments
Open

Some chars need to be escaped #349

Goooler opened this issue Jun 30, 2024 · 3 comments

Comments

@Goooler
Copy link
Contributor

Goooler commented Jun 30, 2024

My changelog looks like this:

### Added
* In order to use `custom`, you must now use Gradle 8.0+.

I use this action to pick it and release it like:

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Extract release notes
        id: extract-release-notes
        uses: ffurrer2/extract-release-notes@v2
      - name: Create release
        run: gh release create --title ${{ github.ref_name }} --notes '${{ steps.extract-release-notes.outputs.release_notes }}'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

and the errors will show:

/home/runner/work/_temp/b424905f-a1d2-4aef-ba90-8f409d60cac5.sh: line 2: custom: command not found

in this case, I tried to write the output into a file and pick the file from GH CLI like:

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Extract release notes
        id: extract-release-notes
        uses: ffurrer2/extract-release-notes@v2
      - name: Write release note into a file
        run: echo "${{ steps.extract-release-notes.outputs.release_notes }}" > release_notes.txt
      - name: Create release
        run: gh release create --title ${{ github.ref_name }} --notes-file release_notes.txt
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The same error shown. I believe we have to escape "`" in my example and write it to a file:

echo "### Added\n* In order to use \`custom\`, you must now use Gradle 8.0+.\n" > note.txt

cat note.txt

### Added
* In order to use `custom`, you must now use Gradle 8.0+.
@Goooler
Copy link
Contributor Author

Goooler commented Jul 1, 2024

I know why, must use single quotations ('') instead of double quotations ("") here.

@Goooler Goooler closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2024
@Goooler Goooler reopened this Jul 1, 2024
@Goooler
Copy link
Contributor Author

Goooler commented Jul 1, 2024

A new case:

### Added
- it's there

run

echo '### Added
- it's there' > note.txt
quote>

this ' could not be escaped except using double quotations.

@Goooler
Copy link
Contributor Author

Goooler commented Jul 5, 2024

Workaround: using release_notes_file to save the note and gh release create ${{ github.ref_name }} --notes-file RELEASE_NOTES.md. Example:

https://github.com/Goooler/keep-a-changelog/blob/05bcaa22238adc5f9f904e2003761c4005365cdd/.github/workflows/release.yaml#L15-L20

Goooler added a commit to Goooler/licensee that referenced this issue Sep 5, 2024
- Rename the step.
- Grant write permission to the contents to ensure releases are published correctly.
- The `--title` option is redundant, as the title defaults to the tag name when both are identical.
- Prefer using `--notes-file` over `--notes` to avoid issues like ffurrer2/extract-release-notes#349.
JakeWharton pushed a commit to cashapp/licensee that referenced this issue Sep 5, 2024
- Rename the step.
- Grant write permission to the contents to ensure releases are published correctly.
- The `--title` option is redundant, as the title defaults to the tag name when both are identical.
- Prefer using `--notes-file` over `--notes` to avoid issues like ffurrer2/extract-release-notes#349.
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

No branches or pull requests

1 participant