Skip to content

Commit

Permalink
fix(ci): properly escape PR title (#3318)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomaseizinger authored Jan 17, 2023
1 parent 735945d commit 29a7716
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 29a7716

Please sign in to comment.