Skip to content

general

general #293

Workflow file for this run

name: general
on:
workflow_dispatch:
push:
branches:
- main
schedule:
# run this everyday at 12:00AM UTC
- cron: "0 0 * * *"
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
concurrency:
group: general-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
BRANCH_NAME: bazel/lock-requirements
GIT_AUTHOR_NAME: ${{ github.repository_owner }}
GIT_AUTHOR_EMAIL: ${{ github.repository_owner }}@users.noreply.github.com
jobs:
format:
name: "Create a style PR"
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup CI
uses: ./.github/actions/setup-repo
- name: Setup buf
uses: bufbuild/buf-setup-action@v1.9.0
with:
github_token: ${{ github.token }}
- name: Run tooling
run: |
bazel run //:buildfmt
bazel run //:black -- "${{ github.workspace }}/src"
bazel run //:black -- --pyi "${{ github.workspace }}/typings" "${{ github.workspace }}/src/bentoml/metrics.pyi"
bazel run //:isort -- "${{ github.workspace }}/src"
buf format --config "${{ github.workspace }}/src/bentoml/grpc/buf.yaml" -w src/bentoml/grpc
- name: Install jq and curl
run: sudo apt-get install -y jq curl
- name: Get infos
id: meta
run: |
REPO="bentoml/bentoml"
COMMIT_INFO="$(curl "https://api.github.com/repos/$REPO/commits/main")"
SHA="$(echo $COMMIT_INFO | jq -r ".sha")"
URL="$(echo $COMMIT_INFO | jq -r ".html_url")"
DATE="$(date "+%Y-%m-%d %H:%M:%S %Z%z")"
echo "sha=$SHA" >> $GITHUB_OUTPUT
echo "url=$URL" >> $GITHUB_OUTPUT
echo "date=$DATE" >> $GITHUB_OUTPUT
- name: Create a PR
uses: peter-evans/create-pull-request@v4
with:
title: "ci: formatter and style"
commit-message: "style: format and lint (${{ steps.meta.outputs.sha }})"
body: Follow up from commit ${{ steps.meta.outputs.sha }} [${{ steps.meta.outputs.url }}] at ${{ steps.meta.outputs.date }}
branch-suffix: timestamp
signoff: true
delete-branch: true
reviewers: aarnphm
author: ${{ env.GIT_AUTHOR_NAME }} <${{ env.GIT_AUTHOR_EMAIL }}>
branch: ${{ env.BRANCH_NAME }}