Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,21 @@ env:
LOCALE_ID: 'en-US'

jobs:
check-run:
ci-conditions:
name: 'CI conditions'
runs-on: 'ubuntu-latest'
outputs:
should-skip: ${{ steps.check.outputs.should-skip }}
IS_FORK: ${{ github.repository_owner != 'getodk' }}
IS_PR: ${{ github.event_name == 'pull_request' }}

steps:
- name: Check for duplicate push event with PR
id: check
if: github.event_name == 'push'
run: |
# Check if this push is tied to an open PR
PR_NUMBER=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" | \
jq -r '.[0].number // "none"')
if [ "$PR_NUMBER" != "none" ]; then
echo "This push (commit ${{ github.sha }}) is part of PR #$PR_NUMBER, skipping to avoid duplication with pull_request event."
echo "should-skip=true" >> $GITHUB_OUTPUT
exit 0
else
echo "No associated PR found, proceeding with CI for this push."
echo "should-skip=false" >> $GITHUB_OUTPUT
fi
- name: Capture CI conditions
id: capture-ci-conditions
run: exit 0

install-and-build:
needs: check-run
if: ${{ needs.check-run.outputs.should-skip != 'true' }}
needs: ci-conditions
if: ${{ needs.ci-conditions.outputs.IS_PR != 'true' || needs.ci-conditions.outputs.IS_FORK == 'true' }}
name: 'Install dependencies and build packages'
runs-on: 'ubuntu-latest'

Expand Down
Loading