name: Pull Request Build on: pull_request: permissions: contents: write pull-requests: write jobs: build: name: Build runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v6 with: fetch-depth: 0 - name: Setup build uses: ./.gitea/actions/setup-build with: maven-credentials: ${{ secrets.SW_MAVEN_CREDENTIALS }} - name: Determine affected projects id: affected shell: bash run: | set -euo pipefail base_branch="$(jq -r '.pull_request.base.ref' "$GITHUB_EVENT_PATH")" base="$(git merge-base "origin/${base_branch}" HEAD || true)" bash .gitea/scripts/affected-projects.sh .ci "$base" - name: Build with Gradle if: steps.affected.outputs.tasks != '' shell: bash env: TASKS: ${{ steps.affected.outputs.tasks }} run: | set -euo pipefail read -ra tasks <<< "$TASKS" ./gradlew "${tasks[@]}" --no-daemon - name: Merge successful backport PR shell: bash env: GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} BACKPORT_BRANCH_PREFIX: backport/commoncore run: | set -euo pipefail head_branch="$(jq -r '.pull_request.head.ref // ""' "$GITHUB_EVENT_PATH")" base_branch="$(jq -r '.pull_request.base.ref // ""' "$GITHUB_EVENT_PATH")" pr_number="$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH")" if [[ "${head_branch}" != "${BACKPORT_BRANCH_PREFIX}/"* ]]; then echo "Not a CommonCore backport PR." exit 0 fi if [[ "${base_branch}" != version/* ]]; then echo "Backport PR target is not a version/* branch." exit 0 fi api_url="${GITHUB_API_URL:-${GITHUB_SERVER_URL}/api/v1}" curl -fsS -X POST \ -H "Accept: application/json" \ -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/json" \ -d '{"Do":"merge","delete_branch_after_merge":true}' \ "${api_url}/repos/${GITHUB_REPOSITORY}/pulls/${pr_number}/merge"