Keepers 1f8c3cdb11
only run actions on /src changes (#750)
## Description

Re-opening the PR with a hack (sourced from github
themselves) to skip the required check if we don't run
the standard required jobs.

## Type of change

- [x] 🌻 Feature

## Issue(s)

#744

## Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
2022-09-02 22:30:18 +00:00

76 lines
1.8 KiB
YAML

name: Lint
on:
push:
branches: [main]
paths:
- '/src/**'
- '/.github/**'
pull_request:
branches: [main]
paths:
- '/src/**'
- '/.github/**'
permissions:
contents: read
jobs:
Linting:
environment: Testing
runs-on: ubuntu-latest
defaults:
run:
working-directory: src
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Get values for cache paths to be used in later steps
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- name: Golang Setup
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Cache Go Mod
uses: actions/cache@v3
id: cache
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Download package dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: go mod download
- name: Cache Go build
uses: actions/cache@v3
id: mybuild
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Build for Lint
if: steps.mybuild.outputs.cache-hit != 'true'
run: go build ./...
- name: Go Lint
uses: golangci/golangci-lint-action@v3.2.0
with:
version: v1.45.2
working-directory: ./src
skip-pkg-cache: true
skip-build-cache: true
skip-go-installation: true
# check licenses
- name: Get go-licenses
run: go install github.com/google/go-licenses@latest
- name: Run go-licenses
run: go-licenses check github.com/alcionai/corso --ignore github.com/alcionai/corso