Merge pull request #3850 from haskell/dependabot/github_actions/fkirc… #2944
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pre-commit | |
on: | |
pull_request: | |
push: | |
branches: [master] | |
jobs: | |
file-diff: | |
runs-on: ubuntu-latest | |
outputs: | |
git-diff: ${{ steps.git-diff.outputs.diff }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Find changed files | |
uses: technote-space/get-diff-action@v6.1.2 | |
id: git-diff | |
with: | |
PATTERNS: | | |
+(src|exe|test|ghcide|plugins|hls-plugin-api|hie-compat|hls-graph|hls-test-utils)/**/*.hs | |
pre-commit: | |
runs-on: ubuntu-latest | |
needs: file-diff | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/setup-build | |
with: | |
# select a stable GHC version | |
ghc: 9.2 | |
os: ${{ runner.os }} | |
shorten-hls: false | |
- name: "Install stylish-haskell" | |
run: | | |
cabal install stylish-haskell | |
echo "${HOME}/.cabal/bin" >> $GITHUB_PATH | |
- name: "Check stylish-haskell is available" | |
run: | | |
echo $(which stylish-haskell) | |
- name: Compiled deps cache | |
id: stylish-haskell-compiled-cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: stylish-haskell-compiled-cache | |
with: | |
path: ${{ env.CABAL_PKGS_DIR }} | |
key: ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }} | |
restore-keys: | | |
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}- | |
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}- | |
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}- | |
- uses: actions/setup-python@v4 | |
- uses: pre-commit/action@v3.0.0 | |
with: | |
extra_args: --files ${{ needs.file-diff.outputs.git-diff }} |