diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index bc14ae91ce..3cca57afca 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -44,14 +44,25 @@ jobs: repository: smarthomeNG/smarthome ref: ${{steps.extract_branch.outputs.branch}} path: smarthomeng - - - name: Checkout repository PLUGINS ${{steps.extract_branch.outputs.branch}} Branch + + - name: Check if branch '${{ steps.extract_branch.outputs.branch }}' exists in smarthomeNG/plugins + run: echo "code=$(git ls-remote --exit-code --heads https://github.com/smarthomeNG/plugins ${{ steps.extract_branch.outputs.branch }} > /dev/null; echo $? )" >>$GITHUB_OUTPUT + id: plugins_branch_check + + - name: Checkout plugins from branch '${{ steps.extract_branch.outputs.branch }}' (for push on known smarthomeNG/smarthome branch) + if: github.event_name != 'pull_request' && steps.plugins_branch_check.outputs.code == '0' uses: actions/checkout@v3 with: - repository: smarthomeNG/smarthome - ref: ${{steps.extract_branch.outputs.branch}} - path: plugins - + repository: smarthomeNG/plugins + ref: ${{ steps.extract_branch.outputs.branch }} + + - name: Checkout plugins from branch 'develop' (for pull request or push on unknown smarthomeNG/smarthome branch) + if: github.event_name == 'pull_request' || steps.plugins_branch_check.outputs.code == '2' + uses: actions/checkout@v3 + with: + repository: smarthomeNG/plugins + ref: develop + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2