Skip to content

Commit

Permalink
build: Use Accept:application/vnd.github.VERSION.sha to get the lates…
Browse files Browse the repository at this point in the history
…t sha of sentry-api-schema repo (#9106)

* build: Use Accept:application/vnd.github.VERSION.sha to get the latest sha of sentry-api-schema repo

* Add some bash flags

* print some helpful statement along the way
  • Loading branch information
ryan953 authored Feb 11, 2024
1 parent 5738d6e commit 85567c8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/bump-api-schema-sha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ jobs:
# kick off for the PR we're about to create.
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }}
run: |
set -euo pipefail
git config user.email "[email protected]"
git config user.name "openapi-getsentry-bot"
filepath="src/build/resolveOpenAPI.ts"
sha="$(curl -sSL 'https://api.github.com/repos/getsentry/sentry-api-schema/commits/main' | awk 'BEGIN { RS=",|:{\n"; FS="\""; } $2 == "sha" { print $4 }')"
sha="$(curl -sSl -H 'Accept: application/vnd.github.VERSION.sha' 'https://api.github.com/repos/getsentry/sentry-api-schema/commits/main')"
echo "Latest commit to 'getsentry/sentry-api-schema' is $sha"
sed -i -e "s|^const SENTRY_API_SCHEMA_SHA =.*$|const SENTRY_API_SCHEMA_SHA = '$sha';|g" "$filepath"
echo "Updated $filepath"
branch="bot/bump-api-schema-to-${sha:0:8}"
git checkout -b "$branch"
Expand Down

0 comments on commit 85567c8

Please sign in to comment.