diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3af5c23..940cc7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: tag: ci-test-${{ matrix.os }}-${{ github.run_id }} overwrite: true prerelease: true - body: "rofl lol test%0Aianal fubar" + body: "rofl lol test%0Aianal %25 fubar" - name: Check that the uploaded asset is readable uses: actions/github-script@v2 with: @@ -47,7 +47,7 @@ jobs: tag: "ci-test-${{ matrix.os }}-${{ github.run_id }}", }) assert.deepStrictEqual(release.data.prerelease, true) - assert.deepStrictEqual(release.data.body, "rofl lol test\nianal fubar") + assert.deepStrictEqual(release.data.body, "rofl lol test\nianal % fubar") assert.deepStrictEqual(release.data.assets[0].name, "TEST.md") const actual = child_process.execSync(`curl -Ls ${release.data.assets[0].browser_download_url}`) assert.deepStrictEqual(expected, actual) diff --git a/dist/index.js b/dist/index.js index 366b69d..07bb82c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -133,7 +133,11 @@ function run() { const overwrite = core.getInput('overwrite') == 'true' ? true : false; const prerelease = core.getInput('prerelease') == 'true' ? true : false; const release_name = core.getInput('release_name'); - const body = core.getInput('body'); + const body = core + .getInput('body') + .replace(/%0A/gi, '\n') + .replace(/%0D/gi, '\r') + .replace(/%25/g, '%'); const octokit = github.getOctokit(token); const release = yield get_release_by_tag(tag, prerelease, release_name, body, octokit); if (file_glob) { diff --git a/src/main.ts b/src/main.ts index 5c9ccb8..e93d9d3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -142,7 +142,11 @@ async function run(): Promise { const overwrite = core.getInput('overwrite') == 'true' ? true : false const prerelease = core.getInput('prerelease') == 'true' ? true : false const release_name = core.getInput('release_name') - const body = core.getInput('body') + const body = core + .getInput('body') + .replace(/%0A/gi, '\n') + .replace(/%0D/gi, '\r') + .replace(/%25/g, '%') const octokit = github.getOctokit(token) const release = await get_release_by_tag(