Skip to content

feat: update code block to use col max words #426

feat: update code block to use col max words

feat: update code block to use col max words #426

Workflow file for this run

name: Format & Tidy go.mod
on:
pull_request:
paths:
- '**.go'
- '**.mod'
- 'Makefile'
- '.github/workflows/format-tidy.yml'
branches:
- 'main'
jobs:
cleanup-runs:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.owner.login == github.repository_owner
steps:
- uses: rokroskar/workflow-run-cleanup-action@v0.3.3
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
format:
name: format
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.owner.login == github.repository_owner
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Format code
run:
make format
- name: Tidy go.mod
run:
make tidy
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v19
id: verify-changed-files
with:
files: |
**/*.go
*.mod
*.sum
- name: Commit formatting changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add cmd ${{ steps.verify-changed-files.outputs.changed_files }}
git commit -m "Formatted code."
- name: Push formatting changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT_TOKEN }}
branch: ${{ github.head_ref }}