0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Switched to printf to echo GitHub context

- printf is a little safer and should prevent issues with command
  execution within the metadata job
This commit is contained in:
Daniel Lockyer 2023-07-10 16:55:52 +02:00 committed by Daniel Lockyer
parent 869eb04eed
commit f7aeb4138e

View file

@ -43,7 +43,7 @@ jobs:
- name: Get metadata (push) - name: Get metadata (push)
if: github.event_name == 'push' if: github.event_name == 'push'
run: | run: |
NUMBER_OF_COMMITS=$(echo '${{ env.GITHUB_CONTEXT }}' | jq '.event.commits | length') NUMBER_OF_COMMITS=$(printf "%s\n" '${{ toJson(github.event.commits.*.id) }}' | jq length)
echo "There are $NUMBER_OF_COMMITS commits in this push." echo "There are $NUMBER_OF_COMMITS commits in this push."
echo "BASE_COMMIT=$(git rev-parse HEAD~$NUMBER_OF_COMMITS)" >> $GITHUB_ENV echo "BASE_COMMIT=$(git rev-parse HEAD~$NUMBER_OF_COMMITS)" >> $GITHUB_ENV