Skip to content

Commit

Permalink
workflow: Fix unittest for forked repos
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberth committed Apr 20, 2023
1 parent b4bf338 commit 64e4e44
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ jobs:
echo github.pull_request.base.ref '${{ github.pull_request.base.ref }}'
echo steps.extract_branch.outputs.branch '${{ steps.extract_branch.outputs.branch }}'
- name: Checkout core from branch '${{ steps.extract_branch.outputs.branch }}' (for push)
if: github.event_name != 'pull_request'
- name: Check if branch '${{ steps.extract_branch.outputs.branch }}' exists in smarthomeNG/smarthome
run: echo "code=$(git ls-remote --exit-code --heads https://github.com/smarthomeNG/smarthome ${{ steps.extract_branch.outputs.branch }} > /dev/null; echo $? )" >>$GITHUB_OUTPUT
id: shng_branch_check

- name: Checkout core from branch '${{ steps.extract_branch.outputs.branch }}' (for push on known smarthomeNG/smarthome branch)
if: github.event_name != 'pull_request' && steps.shng_branch_check.outputs.code == '0'
uses: actions/checkout@v3
with:
repository: smarthomeNG/smarthome
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Checkout core from branch 'develop' (for pull request)
if: github.event_name == 'pull_request'
- name: Checkout core from branch 'develop' (for pull request or push on unknown smarthomeNG/smarthome branch)
if: github.event_name == 'pull_request' || steps.shng_branch_check.outputs.code == '2'
uses: actions/checkout@v3
with:
repository: smarthomeNG/smarthome
Expand All @@ -59,7 +63,7 @@ jobs:
- name: Checkout plugins from branch '${{steps.extract_branch.outputs.branch}}'
uses: actions/checkout@v3
with:
repository: smarthomeNG/plugins
repository: ${{ github.repository_owner }}/plugins
ref: ${{steps.extract_branch.outputs.branch}}
path: plugins

Expand Down

0 comments on commit 64e4e44

Please sign in to comment.