Update gha #23
Workflow file for this run
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: 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 | |
- 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 company files | |
id: changed-company-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: priv/companies/**.exs | |
# id: changed_files | |
# run: | | |
# changed_files=$(git log --name-only $(git merge-base origin/main HEAD)..HEAD | grep priv/companies/ | uniq) | |
# # Convert newline-separated list to a comma-separated string | |
# changed_files=$(echo "$changed_files" | tr '\n' ',') | |
# # Remove the trailing comma before assigning to GITHUB_OUTPUT | |
# echo "files=${changed_files%,}" >> $GITHUB_OUTPUT | |
- name: Validate Company | |
if: steps.changed-company-files.outputs.any_changed == 'true' | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-company-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
mix validate_company_file "$file" | |
done | |
# run: | | |
# IFS=',' read -r -a files <<< "${{ steps.changed_files.outputs.files }}" | |
# for file in "${files[@]}"; do | |
# if [[ $file == *.exs ]]; then | |
# mix validate_company_file "$file" | |
# fi | |
# done |