Remove individual access to repos #17531
This file contains hidden or 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: 'Remove individual access to repos' | |
| on: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: '0 */1 * * *' | |
| jobs: | |
| remove-individual-access-to-repos: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: community | |
| - name: Install yq | |
| run: sudo wget https://oauth2:${{ secrets.GITHUB_TOKEN }}@github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq -q && sudo chmod +x /usr/bin/yq | |
| - name: Remove individual access to repos | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| run: | | |
| set -e | |
| set -o pipefail | |
| ./community/toc/working-groups/parsable-working-groups.sh | jq -r .[].areas[].repositories[] | grep -E '^cloudfoundry/' | while read -r repo; do | |
| gh api "repos/${repo}/collaborators?affiliation=direct" | jq -r .[].login | while read -r user; do | |
| echo "remove ${user} from ${repo}" | |
| gh api -X delete "/repos/${repo}/collaborators/${user}" | |
| done | |
| done |