Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GHA update-proto.yml #164

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 in api-go repo 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
Loading