name: Protobuf update on: pull_request: types: [labeled] permissions: {} jobs: my_job: name: Update protobuf dependency runs-on: ubuntu-latest if: github.event.label.name == 'protobuf' permissions: contents: write # required to push commit to PR branch steps: - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 persist-credentials: true # zizmor: ignore[artipacked] - name: Update versions.mk with latest release version run: | export PROTOC_VERSION="$(awk -F'[:@]' '/FROM ghcr.io\/homebrew\/core\/protobuf/{print $2; exit}' protoc-builder/hack/Dockerfile.protobuf)" echo "Detected protobuf v${PROTOC_VERSION}... computing digest of artifact" export PROTOC_ZIP=$(mktemp) curl -fsSL --retry 3 -o ${PROTOC_ZIP} https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip export PROTOC_CHECKSUM="$(sha256sum ${PROTOC_ZIP} | awk '{print "sha256:"$1}')" sed -i 's/^\(DEFAULT_PROTOC_VERSION\s*=\s*\).*/\1'v${PROTOC_VERSION}'/' protoc-builder/versions.mk sed -i 's/^\(DEFAULT_PROTOC_CHECKSUM\s*=\s*\).*/\1'${PROTOC_CHECKSUM}'/' protoc-builder/versions.mk - name: Amend Dependabot PR env: PULL_REQUEST_HEAD_REF: ${{ github.event.pull_request.head.ref }} run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add -A git commit -sam "Bumping default protoc version and checksum in versions.mk" git push origin HEAD:${PULL_REQUEST_HEAD_REF}