From 39a4f30c0f2b9e52891b9f03afa6fbcca50b9a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sch=C3=B6chlin?= Date: Wed, 2 Oct 2024 16:49:11 +0200 Subject: [PATCH 1/6] add a dryrun check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Schöchlin --- .../dryrun-manage-github-repositories.yml | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/dryrun-manage-github-repositories.yml diff --git a/.github/workflows/dryrun-manage-github-repositories.yml b/.github/workflows/dryrun-manage-github-repositories.yml new file mode 100644 index 0000000..1dd2f86 --- /dev/null +++ b/.github/workflows/dryrun-manage-github-repositories.yml @@ -0,0 +1,55 @@ +--- +name: Manage github repositories + +"on": + workflow_dispatch: + 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: Manage github repositories with Ansible + run: | + pipenv run ansible-playbook playbook.yaml -e api_token=$API_TOKEN --check + env: + API_TOKEN: ${{ secrets[format('GHP_{0}', github.actor)] }} + +# TODO - to be clarified: Whats this? +# - name: Manage github repositories with Python +# run: | +# pipenv run python3 manage.py --keep_labels TRUE +# env: +# API_TOKEN: ${{ secrets[format('GHP_{0}', github.actor)] }} From c9a67051d0beedcb7f42bdff3acf9af1f266c2c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sch=C3=B6chlin?= Date: Wed, 2 Oct 2024 16:50:49 +0200 Subject: [PATCH 2/6] test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Schöchlin --- .github/workflows/dryrun-manage-github-repositories.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dryrun-manage-github-repositories.yml b/.github/workflows/dryrun-manage-github-repositories.yml index 1dd2f86..3daa7f7 100644 --- a/.github/workflows/dryrun-manage-github-repositories.yml +++ b/.github/workflows/dryrun-manage-github-repositories.yml @@ -47,7 +47,8 @@ jobs: env: API_TOKEN: ${{ secrets[format('GHP_{0}', github.actor)] }} -# TODO - to be clarified: Whats this? +# TODO, to be clarified: Whats this? +# # - name: Manage github repositories with Python # run: | # pipenv run python3 manage.py --keep_labels TRUE From 9e3883a6875cc011c3b60c30270733b1c2a28ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sch=C3=B6chlin?= Date: Wed, 2 Oct 2024 17:38:35 +0200 Subject: [PATCH 3/6] add push MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Schöchlin --- .github/workflows/dryrun-manage-github-repositories.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/dryrun-manage-github-repositories.yml b/.github/workflows/dryrun-manage-github-repositories.yml index 3daa7f7..c3aa376 100644 --- a/.github/workflows/dryrun-manage-github-repositories.yml +++ b/.github/workflows/dryrun-manage-github-repositories.yml @@ -3,6 +3,9 @@ name: Manage github repositories "on": workflow_dispatch: + push: + branches-ignore: + - main pull_request: branches-ignore: - main From 68fef5edcbaa82a13a61c0da0aa2de4d1dd92f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sch=C3=B6chlin?= Date: Wed, 2 Oct 2024 17:40:24 +0200 Subject: [PATCH 4/6] add diff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Schöchlin --- .github/workflows/dryrun-manage-github-repositories.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dryrun-manage-github-repositories.yml b/.github/workflows/dryrun-manage-github-repositories.yml index c3aa376..932a976 100644 --- a/.github/workflows/dryrun-manage-github-repositories.yml +++ b/.github/workflows/dryrun-manage-github-repositories.yml @@ -46,7 +46,7 @@ jobs: - name: Manage github repositories with Ansible run: | - pipenv run ansible-playbook playbook.yaml -e api_token=$API_TOKEN --check + pipenv run ansible-playbook playbook.yaml -e api_token=$API_TOKEN --check --diff env: API_TOKEN: ${{ secrets[format('GHP_{0}', github.actor)] }} From 7188de1d873f2dea36375b1ad80cb22be8e1f375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sch=C3=B6chlin?= Date: Wed, 2 Oct 2024 17:47:36 +0200 Subject: [PATCH 5/6] Rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Schöchlin --- .../workflows/dryrun-manage-github-repositories.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/dryrun-manage-github-repositories.yml b/.github/workflows/dryrun-manage-github-repositories.yml index 932a976..1a6c8da 100644 --- a/.github/workflows/dryrun-manage-github-repositories.yml +++ b/.github/workflows/dryrun-manage-github-repositories.yml @@ -44,16 +44,8 @@ jobs: run: | ansible-galaxy collection install git+https://github.com/opentelekomcloud/ansible-collection-gitcontrol.git - - name: Manage github repositories with Ansible + - 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)] }} - -# TODO, to be clarified: Whats this? -# -# - name: Manage github repositories with Python -# run: | -# pipenv run python3 manage.py --keep_labels TRUE -# env: -# API_TOKEN: ${{ secrets[format('GHP_{0}', github.actor)] }} From acd334bcf98a27aa1ec5933d8ee1cefe199683f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sch=C3=B6chlin?= Date: Wed, 2 Oct 2024 17:50:23 +0200 Subject: [PATCH 6/6] Rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Schöchlin --- .github/workflows/dryrun-manage-github-repositories.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dryrun-manage-github-repositories.yml b/.github/workflows/dryrun-manage-github-repositories.yml index 1a6c8da..28e7779 100644 --- a/.github/workflows/dryrun-manage-github-repositories.yml +++ b/.github/workflows/dryrun-manage-github-repositories.yml @@ -1,5 +1,5 @@ --- -name: Manage github repositories +name: Test the management of github repositories "on": workflow_dispatch: