1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-10 14:13:23 +00:00

Detect changes against branch off point, not origin/main (#4337)

This commit is contained in:
Mike Gelfand 2022-12-08 14:41:28 -08:00 committed by GitHub
parent f176bb299a
commit 32cc726e7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,10 +28,10 @@ jobs:
id: check-main-push id: check-main-push
run: | run: |
set -x set -x
if [ "$GITHUB_EVENT_NAME" = 'push' ] && [ "$GITHUB_REF_NAME" = 'main' ]; then \ if [ "$GITHUB_EVENT_NAME" = 'push' ] && [ "$GITHUB_REF_NAME" = 'main' ]; then
echo "::set-output name=is-main-push::1"; \ echo is-main-push=1 >> "$GITHUB_OUTPUT"
else \ else
echo "::set-output name=is-main-push::0"; \ echo is-main-push=0 >> "$GITHUB_OUTPUT"
fi fi
- name: Get Source - name: Get Source
id: get-source id: get-source
@ -44,29 +44,24 @@ jobs:
id: check-diffs id: check-diffs
run: | run: |
set +e set +e
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt Transmission.xcodeproj third-party libtransmission cli MERGE_BASE=`git merge-base origin/main HEAD`
echo "::set-output name=cli-changed::$?" function get_changes() { # name, paths...
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt Transmission.xcodeproj libtransmission cli daemon gtk macosx qt utils tests web third-party local name="$1"
echo "::set-output name=any-code-changed::$?" shift
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt Transmission.xcodeproj libtransmission cli daemon gtk macosx qt utils tests web git -C "$GITHUB_WORKSPACE/src" diff --exit-code "$MERGE_BASE" -- "$@"
echo "::set-output name=our-code-changed::$?" echo "$name-changed=$?" >> "$GITHUB_OUTPUT"
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt Transmission.xcodeproj third-party libtransmission daemon }
echo "::set-output name=daemon-changed::$?" get_changes cli CMakeLists.txt Transmission.xcodeproj third-party libtransmission cli
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- docs get_changes any-code CMakeLists.txt Transmission.xcodeproj libtransmission cli daemon gtk macosx qt utils tests web third-party
echo "::set-output name=docs-changed::$?" get_changes our-code CMakeLists.txt Transmission.xcodeproj libtransmission cli daemon gtk macosx qt utils tests web
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt third-party libtransmission gtk get_changes daemon CMakeLists.txt Transmission.xcodeproj third-party libtransmission daemon
echo "::set-output name=gtk-changed::$?" get_changes docs docs
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt Transmission.xcodeproj third-party libtransmission macosx Transmission.xcodeproj get_changes gtk CMakeLists.txt third-party libtransmission gtk
echo "::set-output name=mac-changed::$?" get_changes mac CMakeLists.txt Transmission.xcodeproj third-party libtransmission macosx Transmission.xcodeproj
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt third-party libtransmission qt get_changes qt CMakeLists.txt third-party libtransmission qt
echo "::set-output name=qt-changed::$?" get_changes tests CMakeLists.txt third-party libtransmission utils tests
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt third-party libtransmission utils tests get_changes utils CMakeLists.txt third-party libtransmission utils
echo "::set-output name=tests-changed::$?" get_changes web CMakeLists.txt third-party libtransmission web
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt third-party libtransmission utils
echo "::set-output name=utils-changed::$?"
git -C "${GITHUB_WORKSPACE}/src" diff --exit-code origin/main -- CMakeLists.txt third-party libtransmission web
echo "::set-output name=web-changed::$?"
set -e
code-style: code-style:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04