Check for unmanaged repositories in organization #210
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Check for unmanaged repositories in organization | |
"on": | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '30 5 * * *' | |
jobs: | |
check-unmanaged-repos: | |
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: Call check_repositories.py | |
id: check | |
shell: sh {0} | |
run: | | |
OUTPUT="$(pipenv run python3 check_repositories.py 2>&1)" | |
RESULT=$? | |
echo "CHECK_RESULT=$OUTPUT" >> "$GITHUB_OUTPUT" | |
exit $RESULT | |
env: | |
API_TOKEN: ${{ secrets[format('GHP_{0}', github.actor)] }} | |
- name: Create issue on failed workflow | |
if: ${{ failure() }} | |
uses: dblock/create-a-github-issue@v3 | |
with: | |
filename: .github/unmanaged-repos-issue.md | |
update_existing: true | |
assignees: itrich | |
search_existing: open | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BODY: ${{ steps.check.outputs.CHECK_RESULT }} |