Skip to content

Commit

Permalink
chore(github): path filtering for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
solareon committed Jul 2, 2024
1 parent cbdaed6 commit 0620ee6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 38 deletions.
33 changes: 8 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: Main CI
on: [push, pull_request]
on:
push:
paths:
- "ui/**"
pull_request:
paths:
- "ui/**"

jobs:
build:
name: Build Test
Expand All @@ -14,47 +21,23 @@ jobs:
with:
fetch-depth: 0

- name: Get Commit Range
id: get_commit_range
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "commit_range=${{ github.event.before }}..HEAD" >> $GITHUB_ENV
else
echo "commit_range=${{ github.event.pull_request.base.sha }}..HEAD" >> $GITHUB_ENV
fi
- name: Check for changes in UI directory
id: check_changes
run: |
if git diff --quiet ${{ env.commit_range }} -- ui; then
echo "No changes in UI directory. Skipping step."
echo "skip_step=true" >> $GITHUB_ENV
else
echo "Changes detected in UI directory. Proceeding with step."
echo "skip_step=false" >> $GITHUB_ENV
fi
- name: Install pnpm
if: env.skip_step == 'false'
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup node environment
if: env.skip_step == 'false'
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
cache-dependency-path: "ui/pnpm-lock.yaml"

- name: Install deps
if: env.skip_step == 'false'
run: pnpm install --frozen-lockfile
working-directory: ui

- name: Try build
if: env.skip_step == 'false'
run: pnpm build
working-directory: ui
env:
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Lint
on: [push, pull_request_target]
on:
push:
paths:
- "*.lua"
pull_request_target:
paths:
- "*.lua"
jobs:
lint:
name: Lint Resource
Expand All @@ -9,25 +15,13 @@ jobs:
with:
fetch-depth: 2
ref: ${{ github.event.pull_request.head.sha }}
- name: Check for lua changes
id: check_changes
run: |
if git diff --quiet HEAD^ HEAD -- '*.lua'; then
echo "No changes to lua files. Skipping step."
echo "skip_step=true" >> $GITHUB_ENV
else
echo "Changes detected to lua files. Proceeding with step."
echo "skip_step=false" >> $GITHUB_ENV
fi
- name: Lint
if: env.skip_step == 'false'
uses: iLLeniumStudios/fivem-lua-lint-action@v2
with:
capture: "junit.xml"
args: "-t --formatter JUnit"
extra_libs: ox_lib+mysql+qblocales+qbox+qbox_playerdata+qbox_lib
- name: Generate Lint Report
if: env.skip_step == 'false'
uses: mikepenz/action-junit-report@v4
with:
report_paths: "**/junit.xml"
Expand Down

0 comments on commit 0620ee6

Please sign in to comment.