Skip to content

Commit

Permalink
#9: fix check_pr step
Browse files Browse the repository at this point in the history
  • Loading branch information
arburk committed Feb 4, 2024
1 parent a57a574 commit 4836872
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/connected_check_on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@ jobs:
# Allow tests to continue on other devices if they fail on one device.
fail-fast: false
matrix:
api-level: [ 27, 28, 29, 30, 31, 32, 33, 34 ]
api-level: [ 27 ]
env:
JAVA_TOOL_OPTIONS: -Xmx4g

steps:
- name: install jq
run: sudo apt install jq

- name: Check if PR exists or branch is main
id: check_pr
run: |
branch_name=$(echo ${GITHUB_REF#refs/heads/})
prs=$(curl -s -X GET -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${branch_name}")
pr_exists_or_main_branch=0
if [ $branch_name != 'main' && $(echo "$prs" | jq length) -eq 0 ]; then
giturl = "https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:$branch_name"
echo "$giturl"
prs=$(curl -s -X GET -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $giturl)
echo "$prs"
if [ $branch_name -e 'main' && $(echo "$prs" | jq length) -eq 0 ]; then
echo "Skip instrumented tests (no open PR found for branch $branch_name and not main branch)"
exit 0
else
echo "Do perform instrumented tests"
pr_exists_or_main_branch=1
fi
- name: checkout source
Expand Down Expand Up @@ -68,7 +72,7 @@ jobs:
TARGET="google_apis"
if [[ ${{ matrix.api-level }} -ge 30 ]]; then
TARGET="aosp_atd"
else if [[ ${{ matrix.api-level }} -e 27 ]]; then
elif [[ ${{ matrix.api-level }} -e 27 ]]; then
TARGET="default"
fi
echo "TARGET=$TARGET" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 4836872

Please sign in to comment.