|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | +# |
| 18 | + |
| 19 | +name: "Label when approved workflow run" |
| 20 | +on: |
| 21 | + workflow_run: |
| 22 | + workflows: [Label-when-reviewed] |
| 23 | + types: [requested] |
| 24 | +permissions: |
| 25 | + # All other permissions are set to none |
| 26 | + checks: write |
| 27 | + contents: read |
| 28 | + pull-requests: write |
| 29 | +jobs: |
| 30 | + label-when-approved: |
| 31 | + name: "Label when approved" |
| 32 | + runs-on: ubuntu-latest |
| 33 | + outputs: |
| 34 | + isApprovedByCommiters: ${{ steps.label-when-approved-by-commiters.outputs.isApproved }} |
| 35 | + isApprovedByAnyone: ${{ steps.label-when-approved-by-anyone.outputs.isApproved }} |
| 36 | + steps: |
| 37 | + - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" |
| 38 | + uses: actions/checkout@v2 |
| 39 | + with: |
| 40 | + persist-credentials: false |
| 41 | + submodules: recursive |
| 42 | + - name: "Get information about the original trigger of the run" |
| 43 | + uses: ./.github/actions/get-workflow-origin |
| 44 | + id: source-run-info |
| 45 | + with: |
| 46 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + sourceRunId: ${{ github.event.workflow_run.id }} |
| 48 | + - name: Label when approved by commiters |
| 49 | + uses: ./.github/actions/label-when-approved-action |
| 50 | + id: label-when-approved-by-commiters |
| 51 | + with: |
| 52 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + label: 'approved' |
| 54 | + require_committers_approval: 'true' |
| 55 | + remove_label_when_approval_missing: 'true' |
| 56 | + pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }} |
| 57 | + - name: Label when approved by anyone |
| 58 | + uses: ./.github/actions/label-when-approved-action |
| 59 | + id: label-when-approved-by-anyone |
| 60 | + with: |
| 61 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + label: 'reviewed' |
| 63 | + pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }} |
0 commit comments