Skip to content

Commit

Permalink
Update GHA update-proto.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigozhou committed May 29, 2024
1 parent e204384 commit aa115bf
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/update-proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: "Update Proto"
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to update protos (default: master)"
required: false
default: master
commit_author:
description: "Commit author username"
required: true
Expand All @@ -13,6 +17,9 @@ on:
description: "Commit message"
required: true

permissions:
contents: write

jobs:
sync:
name: "Update proto"
Expand All @@ -24,14 +31,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: true
ref: ${{ github.event.inputs.branch }}
submodules: true
persist-credentials: false

- uses: actions/setup-go@v2
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version-file: 'go.mod'
check-latest: true

- uses: arduino/setup-protoc@v1
with:
Expand All @@ -40,16 +50,17 @@ jobs:
- name: Re-build proto
run: |
make install update-proto test
- name: Commit update
env:
GIT_AUTHOR_NAME: ${{ github.event.inputs.commit_author }}
GIT_AUTHOR_EMAIL: ${{ github.event.inputs.commit_author_email }}
GIT_COMMITTER_NAME: ${{ github.event.inputs.commit_author }}
GIT_COMMITTER_EMAIL: ${{ github.event.inputs.commit_author_email }}
GIT_COMMIT_MESSAGE: ${{ github.event.inputs.commit_message }}
run: |
git remote set-url origin https://x-access-token:${{ secrets.COMMANDER_DATA_TOKEN }}@github.com/${{ github.repository }}
git add .
git commit -m "${{ github.event.inputs.commit_message }}"
git commit -m "${GIT_COMMIT_MESSAGE}"
if [ $? -eq 0 ]; then
git push
else
Expand Down

0 comments on commit aa115bf

Please sign in to comment.