|
| 1 | +--- |
| 2 | +name: Gerrit Required Verify |
| 3 | + |
| 4 | +# yamllint disable-line rule:truthy |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + GERRIT_BRANCH: |
| 9 | + description: "Branch that change is against" |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + GERRIT_CHANGE_ID: |
| 13 | + description: "The ID for the change" |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + GERRIT_CHANGE_NUMBER: |
| 17 | + description: "The Gerrit number" |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + GERRIT_CHANGE_URL: |
| 21 | + description: "URL to the change" |
| 22 | + required: true |
| 23 | + type: string |
| 24 | + GERRIT_EVENT_TYPE: |
| 25 | + description: "Type of Gerrit event" |
| 26 | + required: true |
| 27 | + type: string |
| 28 | + GERRIT_PATCHSET_NUMBER: |
| 29 | + description: "The patch number for the change" |
| 30 | + required: true |
| 31 | + type: string |
| 32 | + GERRIT_PATCHSET_REVISION: |
| 33 | + description: "The revision sha" |
| 34 | + required: true |
| 35 | + type: string |
| 36 | + GERRIT_PROJECT: |
| 37 | + description: "Project in Gerrit" |
| 38 | + required: true |
| 39 | + type: string |
| 40 | + GERRIT_REFSPEC: |
| 41 | + description: "Gerrit refspec of change" |
| 42 | + required: true |
| 43 | + type: string |
| 44 | + TARGET_REPO: |
| 45 | + # yamllint disable-line rule:line-length |
| 46 | + description: "The target GitHub repository needing the required workflow" |
| 47 | + required: true |
| 48 | + type: string |
| 49 | + |
| 50 | +concurrency: |
| 51 | + # yamllint disable-line rule:line-length |
| 52 | + group: required-verify-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }} |
| 53 | + cancel-in-progress: true |
| 54 | + |
| 55 | +jobs: |
| 56 | + prepare: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - name: Clear votes |
| 60 | + uses: lfit/gerrit-review-action@v0.4 |
| 61 | + with: |
| 62 | + host: ${{ vars.GERRIT_SERVER }} |
| 63 | + username: ${{ vars.GERRIT_SSH_REQUIRED_USER }} |
| 64 | + key: ${{ secrets.GERRIT_SSH_REQUIRED_PRIVKEY }} |
| 65 | + known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }} |
| 66 | + gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }} |
| 67 | + gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }} |
| 68 | + vote-type: clear |
| 69 | + - name: Allow replication |
| 70 | + run: sleep 10s |
| 71 | + |
| 72 | + info-yaml-verify: |
| 73 | + needs: prepare |
| 74 | + # yamllint disable-line rule:line-length |
| 75 | + uses: lfit/releng-reusable-workflows/.github/workflows/gerrit-compose-required-info-yaml-verify.yaml@f1c0233862b6e944d4627a68a3f329cc97a50698 # v0.1.2 |
| 76 | + with: |
| 77 | + GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }} |
| 78 | + GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }} |
| 79 | + GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }} |
| 80 | + GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }} |
| 81 | + GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }} |
| 82 | + GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }} |
| 83 | + GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }} |
| 84 | + GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }} |
| 85 | + GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }} |
| 86 | + TARGET_REPO: ${{ inputs.TARGET_REPO }} |
| 87 | + secrets: |
| 88 | + GERRIT_SSH_REQUIRED_PRIVKEY: ${{ secrets.GERRIT_SSH_REQUIRED_PRIVKEY }} |
| 89 | + |
| 90 | + vote: |
| 91 | + if: ${{ always() }} |
| 92 | + # yamllint enable rule:line-length |
| 93 | + needs: [prepare, info-yaml-verify] |
| 94 | + runs-on: ubuntu-latest |
| 95 | + steps: |
| 96 | + - uses: technote-space/workflow-conclusion-action@v3 |
| 97 | + - name: Set vote |
| 98 | + uses: lfit/gerrit-review-action@v0.4 |
| 99 | + with: |
| 100 | + host: ${{ vars.GERRIT_SERVER }} |
| 101 | + username: ${{ vars.GERRIT_SSH_REQUIRED_USER }} |
| 102 | + key: ${{ secrets.GERRIT_SSH_REQUIRED_PRIVKEY }} |
| 103 | + known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }} |
| 104 | + gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }} |
| 105 | + gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }} |
| 106 | + vote-type: ${{ env.WORKFLOW_CONCLUSION }} |
0 commit comments