-
Notifications
You must be signed in to change notification settings - Fork 368
55 lines (47 loc) · 1.96 KB
/
validate_company_industry.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Validate Company Industry
on:
pull_request:
paths:
- "priv/companies/*.exs" # only run on changes to company files
jobs:
validate_struct:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Take ownership of the checkout directory (Git CVE-2022-24765)
run: chown --recursive --reference=/ .
- name: Allow for file ownership conflicts with Docker and GitHub Actions
run: git config --global --add safe.directory '*'
- id: beam
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- id: cache
uses: actions/cache@v3
with:
key: |
${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-credo-${{ hashFiles('mix.lock') }}-${{ github.ref }}
restore-keys: |
${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-credo-${{ hashFiles('mix.lock') }}-${{ format('refs/heads/{0}', github.event.repository.default_branch) }}
${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-credo-
${{ env.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-
path: |
_build
deps
- if: steps.cache.outputs.cache-hit != 'true'
run: mix deps.get
- name: Get changed files
id: changed_files
run: |
changed_files=$(git log --name-only $(git merge-base main HEAD)..HEAD | grep priv/companies/)
echo "files=${changed_files}" >> $GITHUB_OUTPUT
- name: Run validation
run: |
for file in ${{ steps.changed_files.outputs.files }}; do
if [[ $file == *.exs ]]; then
mix validate_company_file $file
fi
done