Skip to content

ci: Fix fetch

ci: Fix fetch #62

Workflow file for this run

name: Go
on:
workflow_call:
workflow_dispatch:
pull_request:
push:
branches:
- '**'
- '!main'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '>=1.23'
- name: Install dependencies
run: go get .
- name: Check formating
run: |
changedFiles=$(go fmt ./...)
if [[ -n $changedFiles ]]; then
echo -e "Follwing files are not formated:\n${changedFiles}"
exit 1
fi
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
only-new-issues: true
- name: Run tests
run: go test -cover ./...
- name: test build
run: go build -o convcommitlint
- uses: actions/upload-artifact@v4
with:
name: convcommitlint
path: convcommitlint
check-commits:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ inputs.fetch-depth }}
ref: ${{ github.head_ref }}
- name: 'get base branch last commit'
run: git fetch origin ${{ inputs.base-branch }}:${{ inputs.base-branch }} --depth 1
shell: bash
if: ${{ github.ref_name != inputs.base-branch }}
- uses: actions/download-artifact@v4
with:
name: convcommitlint
- name: chmod +x
run: chmod +x convcommitlint
- name: check commits
run: ./convcommitlint -b main --create-review="true" --comment-drafts="false"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}