Check consistency of github org configuration #454
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 consistency of github org configuration | |
"on": | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- repositiory-cleanup | |
schedule: | |
- cron: '30 5 * * *' | |
jobs: | |
check-consistency: | |
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_consistency.py | |
id: check | |
shell: bash {0} | |
run: | | |
set -o pipefail | |
pipenv run python3 check_consistency.py | tee "$GITHUB_STEP_SUMMARY" | |
exit $? | |
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.workspace }}/.github/check-consistency-issue.md | |
update_existing: true | |
assignees: scoopex | |
search_existing: open | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BODY: ${{ steps.check.outputs.CHECK_RESULT }} | |
URL_REF: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |