Skip to content

Commit fed34fc

Browse files
scoopexgarloffgithub-advanced-security[bot]
authored
add a dryrun check (#300)
* add a dryrun check * test * add push * add diff * Rename * Potential fix for code scanning alert no. 12: Workflow does not contain permissions Signed-off-by: Marc Schöchlin <schoechlin@osb-alliance.com> Signed-off-by: Kurt Garloff <kurt@garloff.de> Co-authored-by: Kurt Garloff <kurt@garloff.de> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent fc8361b commit fed34fc

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: Test the management of github repositories
3+
permissions:
4+
contents: read
5+
6+
"on":
7+
workflow_dispatch:
8+
push:
9+
branches-ignore:
10+
- main
11+
pull_request:
12+
branches-ignore:
13+
- main
14+
15+
jobs:
16+
manage-github-repositories:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check token permissions
20+
run: |
21+
if [ -z "${{ secrets[format('GHP_{0}', github.actor)] }}" ]; then
22+
echo "No valid PAT found for ${{github.actor}}"
23+
exit 1
24+
else
25+
echo "Found valid PAT for ${{github.actor}}"
26+
fi
27+
28+
- name: Checkout repo
29+
uses: actions/checkout@v3
30+
with:
31+
submodules: true
32+
33+
- name: Setup python
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: '3.10'
37+
cache: 'pipenv'
38+
39+
- name: Install dependencies
40+
run: |
41+
python3 -m pip install --upgrade pip
42+
python3 -m pip install pipenv wheel
43+
pipenv install
44+
45+
- name: Install ansible collection
46+
run: |
47+
ansible-galaxy collection install git+https://github.com/opentelekomcloud/ansible-collection-gitcontrol.git
48+
49+
- name: Test the management of github repositories with Ansible
50+
run: |
51+
pipenv run ansible-playbook playbook.yaml -e api_token=$API_TOKEN --check --diff
52+
env:
53+
API_TOKEN: ${{ secrets[format('GHP_{0}', github.actor)] }}

0 commit comments

Comments
 (0)