diff --git a/.github/workflows/dryrun-manage-github-repositories.yml b/.github/workflows/dryrun-manage-github-repositories.yml new file mode 100644 index 0000000..28e7779 --- /dev/null +++ b/.github/workflows/dryrun-manage-github-repositories.yml @@ -0,0 +1,51 @@ +--- +name: Test the management of github repositories + +"on": + workflow_dispatch: + push: + branches-ignore: + - main + pull_request: + branches-ignore: + - main + +jobs: + manage-github-repositories: + runs-on: ubuntu-latest + steps: + - name: Check token permissions + run: | + if [ -z "${{ secrets[format('GHP_{0}', github.actor)] }}" ]; then + echo "No valid PAT found for ${{github.actor}}" + exit 1 + else + echo "Found valid PAT for ${{github.actor}}" + fi + + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: true + + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: 'pipenv' + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install pipenv wheel + pipenv install + + - name: Install ansible collection + run: | + ansible-galaxy collection install git+https://github.com/opentelekomcloud/ansible-collection-gitcontrol.git + + - name: Test the management of github repositories with Ansible + run: | + pipenv run ansible-playbook playbook.yaml -e api_token=$API_TOKEN --check --diff + env: + API_TOKEN: ${{ secrets[format('GHP_{0}', github.actor)] }}