diff --git a/.github/workflows/adf_alpha.yml b/.github/workflows/adf_alpha.yml index 5a366b7de1..8fbf7256f4 100644 --- a/.github/workflows/adf_alpha.yml +++ b/.github/workflows/adf_alpha.yml @@ -73,8 +73,7 @@ jobs: - name: Trigger Alpha ADF child build shell: bash if: ${{ contains(github.event.head_commit.message, '[trigger adf]') || inputs.cluster_operation == 'TRIGGER_ALPHA_ADF' || github.event.schedule == '0 12 * * *' }} - run: | - pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") + run: | npm install github-api ./scripts/travis/update/update-project.sh -p $TRAVIS_BUILD_NUMBER -t $GH_TOKEN -v alpha -c $TRAVIS_COMMIT \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2cf20d710b..0a264d2e12 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -64,13 +64,48 @@ env: DOCKER_REPOSITORY_STORYBOOK: "${{ secrets.DOCKER_REPOSITORY_DOMAIN }}/alfresco/storybook" DOCKER_REPOSITORY: "${{ secrets.DOCKER_REPOSITORY_DOMAIN }}/alfresco/demo-shell" -jobs: +jobs: + check-if-pr-is-approved: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Check if PR is approved + id: action + uses: kamatama41/get-pr-number-action@v0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Show the number + env: + GH_TOKEN: ${{ github.token }} + DEVEL_FLAG: false #put it to true if you need to develop the pipeline on your own branch. before the final merge put it to false + shell: bash + if: ${{ github.event_name != 'schedule' }} + run: | + if [[ "$DEVEL_FLAG" = false ]] ; then + echo "PR number is: ${{ steps.action.outputs.number }}" + prNumber=${{ steps.action.outputs.number }} + checkApproval=$(gh api /repos/Alfresco/alfresco-ng2-components/pulls/$prNumber/reviews | jq '.[] | select(.state == "APPROVED") | .user.login') + if [[ $checkApproval ]]; then + echo "PR approved" + else + echo "PR not approved yet" + exit 1 + fi + else + echo "you are on your branch: skipping the check. REMEMBER to put DEVEL_FLAG to FALSE before the final merge!" + fi setup: # long timeout required when cache has to be recreated timeout-minutes: 30 name: "Setup" runs-on: ubuntu-22.04 + needs: [check-if-pr-is-approved] steps: - name: Checkout repository uses: actions/checkout@v3