pullrequest.yml (3815B)
1 --- 2 name: Validate 3 on: 4 push: 5 branches: [main] 6 repository_dispatch: 7 types: [validate-command] 8 jobs: 9 linting: 10 runs-on: ubuntu-latest 11 steps: 12 - name: Set commit status as pending 13 uses: myrotvorets/set-commit-status-action@master 14 if: github.event.client_payload.slash_command && github.event.client_payload.pull_request 15 with: 16 status: pending 17 context: Linting changes 18 sha: ${{ github.event.client_payload.pull_request.head.sha }} 19 - name: Checkout repository 20 uses: actions/checkout@v3 21 - name: Run yamllint 22 run: yamllint . 23 - name: Set final commit status 24 uses: myrotvorets/set-commit-status-action@master 25 if: always() && github.event.client_payload.slash_command && github.event.client_payload.pull_request 26 with: 27 sha: ${{ github.event.client_payload.pull_request.head.sha }} 28 status: ${{ job.status }} 29 context: Linting changes 30 31 validate: 32 permissions: 33 issues: write 34 pull-requests: write 35 contents: read 36 statuses: write 37 needs: linting 38 if: github.event.client_payload.slash_command && github.event.client_payload.pull_request 39 runs-on: ubuntu-latest 40 steps: 41 - name: Set commit status as pending 42 uses: myrotvorets/set-commit-status-action@master 43 with: 44 status: pending 45 context: Verifying changes 46 sha: ${{ github.event.client_payload.pull_request.head.sha }} 47 - uses: actions/checkout@v3 48 with: 49 ref: ${{ github.event.client_payload.pull_request.head.ref }} 50 - uses: actions/setup-python@v4 51 with: 52 python-version: '3.12' 53 - run: pip install -r requirements.txt 54 - uses: solvaholic/octodns-sync@main 55 with: 56 config_path: config/production.yaml 57 force: "Yes" 58 env: 59 POWERDNS_API_KEY_NS1: ${{ secrets.POWERDNS_API_KEY_NS1 }} 60 POWERDNS_API_KEY_NS2: ${{ secrets.POWERDNS_API_KEY_NS2 }} 61 POWERDNS_API_KEY_NS3: ${{ secrets.POWERDNS_API_KEY_NS3 }} 62 CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} 63 - name: Get plan output 64 id: meta 65 run: | 66 # Parse plan output into $_plan 67 _plan="$(cat ${GITHUB_WORKSPACE}/octodns-sync.plan)" 68 _plan="${_plan//'%'/'%25'}" 69 _plan="${_plan//$'\n'/'%0A'}" 70 _plan="${_plan//$'\r'/'%0D'}" 71 # Set output 'plan' to $_plan 72 echo "::set-output name=plan::${_plan}" 73 # Set $_sha to the first 7 char of PR head SHA 74 _sha="$(echo "${{ github.event.client_payload.pull_request.head.sha }}" | cut -c 1-7)" 75 # Set output 'sha' to $_sha 76 echo "::set-output name=sha::${_sha}" 77 - name: Find comment 78 uses: peter-evans/find-comment@v2.4.0 79 id: fc 80 with: 81 issue-number: ${{ github.event.client_payload.github.payload.issue.number }} 82 comment-author: github-actions[bot] 83 body-includes: Automatically generated by octodns-sync 84 - name: Add or update PR comment 85 uses: peter-evans/create-or-update-comment@v3.0.2 86 with: 87 issue-number: ${{ github.event.client_payload.github.payload.issue.number }} 88 comment-id: ${{ steps.fc.outputs.comment-id }} 89 body: | 90 ## OctoDNS Plan for `${{ steps.meta.outputs.sha }}` 91 ${{ steps.meta.outputs.plan }} 92 Automatically generated by octodns-sync 93 edit-mode: replace 94 95 - name: Set final commit status 96 uses: myrotvorets/set-commit-status-action@master 97 if: always() 98 with: 99 sha: ${{ github.event.client_payload.pull_request.head.sha }} 100 status: ${{ job.status }} 101 context: Verifying changes