diff --git a/.github/workflows/ansible-tests-pr.yml b/.github/workflows/ansible-tests-pr.yml index 18e12925..d7c56d26 100644 --- a/.github/workflows/ansible-tests-pr.yml +++ b/.github/workflows/ansible-tests-pr.yml @@ -1,4 +1,4 @@ -on: +on: pull_request_target: paths: - config @@ -28,13 +28,6 @@ jobs: needs: authorize runs-on: ubuntu-latest steps: - - name: checkout Ansible collection - uses: actions/checkout@v4 - with: - repository: equinix-labs/ansible-collection-equinix - path: .ansible/collections/ansible_collections/equinix/cloud - ref: main - - name: update packages run: sudo apt-get update -y @@ -46,27 +39,28 @@ jobs: with: python-version: '3.8' - - name: install dependencies - run: pip3 install -r requirements-dev.txt -r requirements.txt - - - name: install collection - run: make install - - - name: replace existing keys - run: rm -rf ~/.ansible/test && mkdir -p ~/.ansible/test && ssh-keygen -m PEM -q -t rsa -N '' -f ~/.ansible/test/id_rsa - - name: checkout Python SDK, this PR uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.ref }} + - name: checkout Ansible collection + uses: actions/checkout@v4 + with: + repository: equinix-labs/ansible-collection-equinix + path: .ansible/collections/ansible_collections/equinix/cloud + ref: main + + - name: install dependencies of ansible collection + run: pip3 install -r requirements-dev.txt -r requirements.txt + working-directory: .ansible/collections/ansible_collections/equinix/cloud + - name: install cloned Python SDK run: python3 -m pip install equinix_metal - working-directory: metal-python - - name: run tests + - name: run tests in ansible collection directory run: make testall - working-directory: .ansible/collections/ansible_collections/equinix/cloud + working-directory: .ansible/collections/ansible_collections/equinix/cloud env: METAL_API_TOKEN: ${{ secrets.METAL_API_TOKEN }}