Skip to content

Commit

Permalink
[CI] Added error codes utility runner workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Anshumaan Kumar Prasad <[email protected]>
  • Loading branch information
aminoxix committed Aug 2, 2021
1 parent 7898196 commit af146e8
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 1,038 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/error-ref-publisher.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Meshery Adapter Library Error Codes Utility Runner
on:
push:
branches:
- 'master'
paths:
- '**.go'

jobs:
Update-error-codes:
name: Error codes utility
if: github.repository == 'meshery/meshery-adapter-library'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# token here with write access to meshery-adapter-library repo
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: 'master'

- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: ${{ secrets.GO_VERSION }}

- name: Run utility
run: |
go get github.com/layer5io/meshkit/cmd/errorutil
go run github.com/layer5io/meshkit/cmd/errorutil -d . update --skip-dirs meshery -i ./helpers -o ./helpers
# to update errorutil* files in meshkit repo
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: '--signoff'
commit_message: "run error codes utility"
file_pattern: helpers/ **.go

# to push changes to meshery docs
- name: Checkout meshery
uses: actions/checkout@v2
with:
repository: 'meshery/meshery'
# token with write access to meshery repository
token: ${{ secrets.GH_ACCESS_TOKEN }}
path: 'meshery'
ref: 'master'

- name: Update and push docs
run: |
echo '{ "errors_export": "" }' | jq --slurpfile export ./helpers/errorutil_errors_export.json '.errors_export = $export[0]' > ./meshery/docs/_data/errorref/meshery-adapter-library_errors_export.json
cd ./meshery
git config user.name l5io
git config user.email [email protected]
if git diff --exit-code --quiet
then
echo "No changes to commit"
exit
fi
git add ./docs/_data/errorref/meshery-adapter-library_errors_export.json
git commit -m "[Docs] Error Code Reference: Updated codes for Meshery Adapter Library" --signoff
git push origin master
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ meshops.proto
/vendor/
/Godeps/

# End of https://www.toptal.com/developers/gitignore/api/go
# Miscellaneous
**errorutil_analyze_errors.json
**errorutil_analyze_summary.json
**errorutil_errors_export.json

# End of https://www.toptal.com/developers/gitignore/api/go
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ proto:
protoc -I meshes/ meshes/meshops.proto --go_out=plugins=grpc:./meshes/

error:
go run github.com/layer5io/meshkit/cmd/errorutil -d . update
go run github.com/layer5io/meshkit/cmd/errorutil -d . analyze -i ./helpers -o ./helpers
Loading

0 comments on commit af146e8

Please sign in to comment.