diff --git a/.github/exporter.sh b/.github/exporter.sh new file mode 100755 index 0000000..8e3a80a --- /dev/null +++ b/.github/exporter.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euo pipefail + +URL="https://exporter.akerl.org/metric" +AUTH="Authorization: Bearer $EXPORTER_TOKEN" +if [[ "$JOB_STATUS" == "success" ]] ; then + VALUE=1 +else + VALUE=0 +fi +BODY="{\"name\":\"gh/${GITHUB_REPOSITORY}\",\"metrics\":[{\"name\":\"ghactions\",\"type\":\"gauge\",\"tags\":{\"repo\":\"${GITHUB_REPOSITORY}\"},\"value\":\"${VALUE}\"}]}" + +echo "$BODY" + +curl -i -XPOST -d "$BODY" -H"$AUTH" "$URL" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8e2d40..b0f5805 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ name: Build - main tags: - "**" - pull_request_target: + pull_request: jobs: build: name: Build @@ -16,5 +16,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v7 - - name: Build - run: /usr/bin/true + - uses: actions/setup-go@v6 + with: + go-version: stable + - name: Install policy-bot + run: go install github.com/palantir/policy-bot@latest + - name: Validate policy-bot + run: policy-bot validate -p policy.yml