Skip to content

[CI] Add approval

[CI] Add approval #30

Workflow file for this run

name: Approval
on:
pull_request:
types: [opened, synchronize]
pull_request_review:
types: [submitted]
env:
BRANCH: ${{ github.base_ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
jobs:
display-approvers:
name: Display approvers
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Display Required Approvers
run: |
git switch -c test
git remote add upstream https://github.com/PaddlePaddle/Paddle.git
git fetch upstream $BRANCH
bash ci/check_approval.sh
approved-actions:
name: Check approval
needs: display-approvers
if: ${{ github.event_name == 'pull_request_review' && github.event.review.state == 'approved' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Check bypass
id: check-bypass
uses: ./.github/actions/check-bypass
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
workflow-name: approval
- name: Display required approvers and check
if: steps.check-bypass.outputs.can_skip != 'true'
run: |
git switch -c test
git remote add upstream https://github.com/PaddlePaddle/Paddle.git
git fetch upstream $BRANCH
bash ci/check_approval.sh