Merge pull request 'Fix release notes not being escaped properly' (#19) from paulvt/forgejo-release:fix-escaping-release-notes into main

Reviewed-on: https://code.forgejo.org/actions/forgejo-release/pulls/19
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
This commit is contained in:
earl-warren 2024-08-18 03:31:03 +00:00
commit 3abc683f45
3 changed files with 22 additions and 2 deletions

View file

@ -21,6 +21,17 @@ jobs:
export FORGEJO_RUNNER_LOGS="${{ steps.forgejo.outputs.runner-logs }}" export FORGEJO_RUNNER_LOGS="${{ steps.forgejo.outputs.runner-logs }}"
forgejo-test-helper.sh run_workflow testdata/upload-download http://testuser:admin1234@${{ steps.forgejo.outputs.host-port }} testuser upload-download forgejo-release "${{ steps.forgejo.outputs.token }}" forgejo-test-helper.sh run_workflow testdata/upload-download http://testuser:admin1234@${{ steps.forgejo.outputs.host-port }} testuser upload-download forgejo-release "${{ steps.forgejo.outputs.token }}"
set -ex
export FORGEJO="${{ steps.forgejo.outputs.url }}"
curl --fail -sS $FORGEJO/api/v1/repos/testuser/upload-download/releases/tags/v2.0 > /tmp/release.json
EXPECTED='No shell expansion should on these notes:
- $(some_command)
- `other_commend`
- "double quoted" and '\''single quoted'\'' strings
- \backslash escape
- !exclamation_mark'
test "$EXPECTED" = "$(jq -r .body < /tmp/release.json)"
- name: testdata/upload-download-private - name: testdata/upload-download-private
run: | run: |
export FORGEJO_RUNNER_LOGS="${{ steps.forgejo.outputs.runner-logs }}" export FORGEJO_RUNNER_LOGS="${{ steps.forgejo.outputs.runner-logs }}"

View file

@ -81,7 +81,10 @@ runs:
export RELEASE_DIR="${{ inputs.release-dir }}" export RELEASE_DIR="${{ inputs.release-dir }}"
export RELEASENOTES="${{ inputs.release-notes }}" export RELEASENOTES=$(cat << 'EOF'
${{ inputs.release-notes }}
EOF
)
export SHA="${{ inputs.sha }}" export SHA="${{ inputs.sha }}"
if test -z "$SHA"; then if test -z "$SHA"; then

View file

@ -36,7 +36,13 @@ jobs:
tag: v2.0 tag: v2.0
token: FORGEJO_TOKEN token: FORGEJO_TOKEN
release-dir: upload-dir-v2 release-dir: upload-dir-v2
release-notes: "RELEASE NOTES V2" release-notes: |-
No shell expansion should on these notes:
- $(some_command)
- `other_commend`
- "double quoted" and 'single quoted' strings
- \backslash escape
- !exclamation_mark
verbose: true verbose: true
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }} - if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
id: release-download id: release-download