Network Config Validator (Netplan/NetworkManager) #3593
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: CLA Check | |
| on: | |
| pull_request_target: | |
| types: [opened, reopened, synchronize] | |
| issue_comment: | |
| types: [created] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| statuses: write | |
| jobs: | |
| cla-check: | |
| runs-on: ubuntu-latest | |
| # Run on PR events OR when someone comments "recheck" on a PR | |
| if: | | |
| github.event_name == 'pull_request_target' || | |
| (github.event_name == 'issue_comment' && | |
| github.event.issue.pull_request && | |
| contains(github.event.comment.body, 'recheck')) | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| sparse-checkout: | | |
| .github/scripts/cla_check.py | |
| .github/cla-signers.json | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: pip install requests | |
| - name: Get PR number | |
| id: pr | |
| run: | | |
| if [ "${{ github.event_name }}" == "issue_comment" ]; then | |
| echo "number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Run CLA check | |
| id: cla | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ steps.pr.outputs.number }} | |
| REPO_OWNER: ${{ github.repository_owner }} | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| run: | | |
| python .github/scripts/cla_check.py | |
| - name: Set commit status | |
| if: always() | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [ "${{ github.event_name }}" == "pull_request_target" ]; then | |
| SHA="${{ github.event.pull_request.head.sha }}" | |
| else | |
| # For comments, fetch the PR to get head SHA | |
| SHA=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
| "https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.pr.outputs.number }}" \ | |
| | jq -r '.head.sha') | |
| fi | |
| if [ "${{ steps.cla.outcome }}" == "success" ]; then | |
| STATE="success" | |
| DESC="All contributors have signed the CLA" | |
| else | |
| STATE="failure" | |
| DESC="CLA signature required from one or more contributors" | |
| fi | |
| curl -s -X POST \ | |
| -H "Authorization: token $GITHUB_TOKEN" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/repos/${{ github.repository }}/statuses/$SHA" \ | |
| -d "{\"state\":\"$STATE\",\"description\":\"$DESC\",\"context\":\"CLA Verification\"}" |