From cc42e26d32539f864c177e0a28d6fe92f361dc4e Mon Sep 17 00:00:00 2001 From: sharpenedblade Date: Sun, 24 Dec 2023 13:26:36 -0800 Subject: [PATCH] Run CI on pull requests --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f66c1c..3327767 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,13 @@ name: Build on: - push: + pull_request: jobs: checks: runs-on: ubuntu-latest steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Lint" run: | @@ -20,7 +20,28 @@ jobs: build: runs-on: ubuntu-latest steps: + + - name: "Checkout" + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v41 + with: + base_sha: ${{ steps.branch-name.outputs.base_ref_branch }} + files: | + kernel/* + copr-sharpenedblade-t2linux-release/* + rust-tiny-dfr/* + t2linux-audio/* + t2linux-config/* + dir_names: "true" + - name: "Increase Disk Space" + if: contains(steps.changed-files.outputs.modified_files, 'kernel') run: | sudo rm -rf /usr/share/dotnet sudo rm -rf /usr/local/lib/android @@ -34,18 +55,17 @@ jobs: mercurial openssh-client p7zip-full ftp bison sudo apt-get autoremove -y - - name: "Checkout" - uses: actions/checkout@v3 - with: - submodules: recursive - - name: "Build" + if: steps.changed-files.outputs.any_changed == 'true' run: | + CHANGED_PACKAGES=( $(for c in ${CHANGES[@]}; do cut -d/ -f1<<<$c; done | sort -u) ) docker run \ --privileged \ -v "$PWD":/repo \ ghcr.io/t2linux/fedora-dev:latest \ - /repo/build-packages.sh + /repo/build-packages.sh "$CHANGED_PACKAGES" + env: + CHANGES: ${{ steps.changed-files.outputs.all_changed_files }} - name: "Upload Artifact" uses: actions/upload-artifact@v3