fix(ci): properly escape PR title (#3318)

Within double quoted strings, bash tries to evaluate everything within backticks as a command. The GitHub security guide recommends to use an intermediary environment variable instead: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable

See https://github.com/libp2p/rust-libp2p/actions/runs/3889880383/jobs/6638520274#step:3:11.
This commit is contained in:
Thomas Eizinger 2023-01-18 09:13:09 +11:00 committed by GitHub
parent 735945db30
commit 29a77164f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,11 +298,12 @@ jobs:
require_scope: false
- name: Check PR title length
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
title="${{ github.event.pull_request.title }}"
title_length=${#title}
title_length=${#TITLE}
if [ $title_length -gt 72 ]
then
echo "PR title is too long (greater than 72 characters)"
exit 1
fi
fi