This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Proto Dependency | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
branch_name: | |
description: 'Branch name' | |
required: true | |
default: '' | |
commit_hash: | |
description: 'Commit hash' | |
required: true | |
default: '' | |
repository_dispatch: | |
types: [proto-dependency-update] | |
jobs: | |
update-the-dependency: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Install toml | |
run: cargo install toml-cli | |
- name: Update the dependency | |
run: | | |
set -e | |
git config --global credential.helper store | |
echo "https://larry-aptos:${{ secrets.CI_TOKEN}}@github.com" > ~/.git-credentials | |
toml set Cargo.toml workspace.dependencies.aptos-protos.rev ${{ github.event.client_payload.commit_hash }} > Cargo.tmp && mv Cargo.tmp Cargo.toml | |
working-directory: aptos-indexer-processors-sdk/ | |
- name: Configure Git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Commit and Push Changes | |
run: | | |
set -e | |
branch_name="${{ github.event.client_payload.branch_name }}-update-aptos-protos" | |
git checkout -b "$branch_name" | |
git add Cargo.toml | |
git commit -m "Update aptos-protos to ${{ github.event.client_payload.commit_hash }}" | |
git push origin "$branch_name" --force | |
env: | |
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }} | |
working-directory: aptos-indexer-processors-sdk/ | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.CI_TOKEN }} | |
commit-message: "Update aptos-protos to ${{ github.event.client_payload.commit_hash }}" | |
branch: ${{ github.event.client_payload.branch_name }}-update-aptos-protos | |
title: "Update aptos-protos to ${{ github.event.client_payload.commit_hash }}" | |
body: "This PR updates aptos-protos to commit ${{ github.event.client_payload.commit_hash }}." | |
base: main |