Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sairamkrish/e517e2e2a66f13e819b09a4129df16cf to your computer and use it in GitHub Desktop.
Save sairamkrish/e517e2e2a66f13e819b09a4129df16cf to your computer and use it in GitHub Desktop.
Github action to run pytest that depends on another private repository
name: UnitTest
on:
workflow_dispatch:
push:
jobs:
unittest:
name: Unit Test
env:
ORG_GITHUB_USERNAME: ${{ secrets.ORG_GITHUB_USERNAME }}
ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
echo "https://$ORG_GITHUB_USERNAME:$ORG_GITHUB_TOKEN@github.com" >> $HOME/.git-credentials
git config --global credential.helper store
pip install poetry
poetry config virtualenvs.create false
poetry install --all-extras --no-root --with dev --no-interaction
rm -rf ${HOME}/.git-credentials
- name: Run pytest
run: |
python -m pytest
permissions:
id-token: write
contents: write
pages: write
repository-projects: write
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment