Skip to content

Update main.go

Update main.go #9

name: MeshKit Error Codes Utility Runner
on:
push:
branches:
- "master"
paths:
- "**.go"
pull_request:
branches:
- "master"
paths:
- "**.go"
jobs:
Update-error-codes:
name: Error codes utility
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
with:
ref: "master"
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: ${{ secrets.GO_VERSION }}
- name: Build Error Utility
run: |
go get github.com/layer5io/meshkit/cmd/errorutil@master
go build -o ~/errorutil github.com/layer5io/meshkit/cmd/errorutil
- name: Run Utility For Meshery Server
run: |
~/errorutil update -d . -i ./server/helpers -o ./server/helpers --skip-dirs mesheryctl
output=$(~/errorutil -d . analyze -i ./server/helpers -o ./server/helpers --skip-dirs mesheryctl | wc -c)
if [ "$output" -ne 0 ]; then
exit 1
fi
echo '{ "errors_export": "" }' | jq --slurpfile export ./server/helpers/errorutil_errors_export.json '.errors_export = $export[0]' > ./docs/_data/errorref/meshery-server_errors_export.json
- name: Run Utility For Mesheryctl
run: |
cd ./mesheryctl
~/errorutil update -d . -i ./helpers -o ./helpers
output=$(~/errorutil -d . analyze -i ./helpers -o ./helpers | wc -c)
if [ "$output" -ne 0 ]; then
exit 1
fi
echo '{ "errors_export": "" }' | jq --slurpfile export ../server/helpers/errorutil_errors_export.json '.errors_export = $export[0]' > ../docs/_data/errorref/mesheryctl_errors_export.json
- name: Commit changes
if: ${{ github.event_name != 'pull_request' }} # Skip for pull requests
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: mesheryctl/helpers server/helpers/ **.go docs/
commit_user_name: l5io
commit_user_email: ci@layer5.io
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: "--signoff"
commit_message: "[Error Codes]: Update Meshery server and mehseryctl error codes and reference"