Skip to content

Commit 3ccdb67

Browse files
committed
/.github/workflows/bump-dependency.yaml: add client token check
1 parent daa75e8 commit 3ccdb67

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/bump-dependency.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,30 @@ on:
55
types: [ bump-dependency ]
66

77
jobs:
8+
auth:
9+
name: Authenticate Caller
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Check client token
13+
env:
14+
PAYLOAD_TOKEN: ${{ github.event.client_payload.token }}
15+
EXPECTED_TOKEN: ${{ secrets.CLIENT_AUTH_TOKEN }}
16+
run: |
17+
set -euo pipefail
18+
# refuse to proceed without a token
19+
if [ -z "${PAYLOAD_TOKEN:-}" ]; then
20+
echo "Unauthorized: missing token"
21+
exit 1
22+
fi
23+
# simple equality check; doesn't echo secrets
24+
if [ "${PAYLOAD_TOKEN}" != "${EXPECTED_TOKEN}" ]; then
25+
echo "Unauthorized: bad token"
26+
exit 1
27+
fi
28+
echo "Caller authenticated"
29+
830
get-label:
31+
needs: auth
932
name: Get Label
1033
outputs:
1134
label: ${{ steps.get-label.outputs.label }}

0 commit comments

Comments
 (0)