Skip to content

Remove projects/ prefix if it exists #778

Remove projects/ prefix if it exists

Remove projects/ prefix if it exists #778

Workflow file for this run

name: gofmt
permissions:
contents: read
on:
pull_request:
paths:
- "**/*.go"
jobs:
run-gofmt:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- name: Merge base branch
id: pull_request
run: |
git config user.name "modular-magician"
git config user.email "[email protected]"
git fetch origin ${{ github.base_ref }} # Fetch the base branch
git merge --no-ff origin/${{ github.base_ref }} # Merge with the base branch
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
cache: false
go-version: '^1.23'
- name: gofmt
run: |
GOFMT_OUTPUT="$(gofmt -l .)"
# Currently no simple way to get a non-0 exit code directly from
# gofmt
if [ -n "$GOFMT_OUTPUT" ]; then
echo "The following files are not formatted properly:" >&2
echo "$GOFMT_OUTPUT" >&2
exit 1
fi
echo "gofmt-output=gofmt success" >> "$GITHUB_OUTPUT"