diff --git a/.github/workflows/bump-api-schema-sha.yml b/.github/workflows/bump-api-schema-sha.yml new file mode 100644 index 0000000000000..73bf5c1f14e18 --- /dev/null +++ b/.github/workflows/bump-api-schema-sha.yml @@ -0,0 +1,26 @@ +name: Bump API Schema SHA +on: + + # This could be run manually, but general expectation is that this fires from GHA in + # getsentry/sentry-api-schema on changes there. See: + # + # https://develop.sentry.dev/api/public/#build-process + + workflow_dispatch: +jobs: + release: + runs-on: ubuntu-latest + name: "Bump API Schema SHA" + steps: + - uses: actions/checkout@v2 + - name: "Bump API Schema SHA" + shell: bash + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + filepath="src/gatsby/utils/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 }')" + sed -i -e 's|^const SENTRY_API_SCHEMA_SHA =.*$|const SENTRY_API_SCHEMA_SHA = "'$SHA'"|g' "$filepath" + git add "$filepath" + git commit -m "Bump API schema to $sha" + git push diff --git a/scripts/bump-api-schema-sha.sh b/scripts/bump-api-schema-sha.sh deleted file mode 100644 index 6dcf9d8219681..0000000000000 --- a/scripts/bump-api-schema-sha.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# This script is part of the API docs build process: -# -# https://develop.sentry.dev/api/public/#build-process - -set -eu - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $SCRIPT_DIR/.. - -SENTRY_API_SCHEMA_SHA="$(curl -sSL 'https://api.github.com/repos/getsentry/sentry-api-schema/commits/main' | awk 'BEGIN { RS=",|:{\n"; FS="\""; } $2 == "sha" { print $4 }')" -sed -i -e 's|^const SENTRY_API_SCHEMA_SHA =.*$|const SENTRY_API_SCHEMA_SHA = "'$SENTRY_API_SCHEMA_SHA'"|g' src/gatsby/utils/resolveOpenAPI.ts