diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 0590558f6..84618de2c 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -28,7 +28,7 @@ concurrency: jobs: build: name: Build Android apk for device - if: github.secret_source != 'None' && (github.event_name != 'push' || !contains(github.event.head_commit.message || '', 'release(mobile):')) + if: github.secret_source != 'None' && (github.event_name != 'push' || github.ref != 'refs/heads/mobile-main' || !contains(github.event.head_commit.message || '', 'release(mobile):')) runs-on: ubuntu-latest steps: diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index 32720d405..6aa828fc3 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -39,7 +39,7 @@ env: jobs: release: - if: github.secret_source != 'None' && (github.event_name != 'push' || !contains(github.event.head_commit.message || '', 'release(desktop):')) + if: github.secret_source != 'None' && (github.event_name != 'push' || github.ref != 'refs/heads/main' || !contains(github.event.head_commit.message || '', 'release(desktop):')) runs-on: ${{ matrix.os }} env: PROD: ${{ github.event.inputs.tag_version == 'true' || github.ref_type == 'tag' || github.event.inputs.store == 'true' }} diff --git a/.github/workflows/build-ios.yml b/.github/workflows/build-ios.yml index 3bbfafa9c..ab3a25e85 100644 --- a/.github/workflows/build-ios.yml +++ b/.github/workflows/build-ios.yml @@ -23,7 +23,7 @@ concurrency: jobs: check-runner: - if: github.secret_source != 'None' && (github.event_name != 'push' || !contains(github.event.head_commit.message || '', 'release(mobile):')) + if: github.secret_source != 'None' && (github.event_name != 'push' || github.ref != 'refs/heads/mobile-main' || !contains(github.event.head_commit.message || '', 'release(mobile):')) runs-on: ubuntu-latest outputs: runner-label: ${{ steps.set-runner.outputs.runner-label }} diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index 4ba68e2a1..c0b6364b0 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -17,11 +17,36 @@ jobs: (github.ref == 'refs/heads/main' && contains(github.event.head_commit.message || '', 'release(desktop):')) || (github.ref == 'refs/heads/mobile-main' && contains(github.event.head_commit.message || '', 'release(mobile):')) steps: - - name: Create or update sync pull request + - name: Check whether source branch is ahead of dev + id: compare env: GH_TOKEN: ${{ github.token }} + shell: bash run: | + set -euo pipefail + source_branch="${GITHUB_REF_NAME}" + compare_ref="$(printf '%s' "dev...${source_branch}" | jq -sRr @uri)" + ahead_by="$(gh api "repos/${GITHUB_REPOSITORY}/compare/${compare_ref}" --jq '.ahead_by')" + + echo "source_branch=${source_branch}" >> "$GITHUB_OUTPUT" + echo "ahead_by=${ahead_by}" >> "$GITHUB_OUTPUT" + + if [ "$ahead_by" -eq 0 ]; then + echo "No commits to sync from ${source_branch} into dev." + else + echo "${source_branch} is ${ahead_by} commit(s) ahead of dev." + fi + + - name: Create or update sync pull request + if: steps.compare.outputs.ahead_by != '0' + env: + GH_TOKEN: ${{ github.token }} + shell: bash + run: | + set -euo pipefail + + source_branch="${{ steps.compare.outputs.source_branch }}" title="chore(sync): merge ${source_branch} into dev" body=$(cat <