5656 fork=false
5757 fi
5858
59+ # Assert Github Token is set
60+ if [ -z "${{ github.token }}" ]; then
61+ echo "Error: Github Token Secret not found"
62+ exit 1
63+ fi
64+
5965 # Bot config
6066 git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
6167 git config --global user.name "github-actions[bot]"
@@ -77,17 +83,17 @@ runs:
7783 fi
7884
7985 # Fetch hash of main branch
80- _hash_main=$(curl -s -H "Authorization: token $GITHUB_TOKEN " \
86+ _hash_main=$(curl -s -H "Authorization: token ${{ github.token }} " \
8187 "https://api.github.com/repos/${{ github.repository }}/commits/${{ github.base_ref }}" | jq -r '.sha')
8288
8389 # Fetch hash of feature branch (via PR number, also works for branches from forks)
84- pr_details=$(curl -s -H "Authorization: token $GITHUB_TOKEN " \
90+ pr_details=$(curl -s -H "Authorization: token ${{ github.token }} " \
8591 "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}")
8692 # Extract the repository and ref (branch name)
8793 source_repo=$(echo "$pr_details" | jq -r '.head.repo.full_name')
8894 branch_name=$(echo "$pr_details" | jq -r '.head.ref')
8995 # Get the latest commit hash from the source repository
90- _hash_feature=$(curl -s -H "Authorization: token $GITHUB_TOKEN " \
96+ _hash_feature=$(curl -s -H "Authorization: token ${{ github.token }} " \
9197 "https://api.github.com/repos/$source_repo/commits/$branch_name" | jq -r '.sha')
9298
9399 echo "Main branch (${{ github.base_ref }}) hash: $_hash_main"
@@ -113,6 +119,15 @@ runs:
113119 # 'create-comment' step
114120 # ----------------------------------------
115121
122+ - name : Create comment specific setup and checks
123+ if : ${{ inputs.step == 'create-comment' }}
124+ run : |
125+ # Assert validator key is set
126+ if [ -z ${{ inputs.validator_key }} ]; then
127+ echo "Error: input 'validator_key' not set"
128+ exit 1
129+ fi
130+ shell : bash
116131
117132 - name : Download artifacts
118133 if : ${{ inputs.step == 'create-comment' }}
0 commit comments