Auto approval for environment in GitHub actions workflow does not work

133 views Asked by At

I have manual approval setup for GitHub actions using environment viz item1,item2 and approver as actor name mohtashims

enter image description here

Below is my workflow where I wish actor mohtashims to auto-approve environment item1 and item2 for deploy job matrix.

I tried using the solution here: https://github.com/activescott/automate-environment-deployment-approval

However, it does not auto-approve as seen in the snapshots below, and waits for manual approval by the actor mohtashims

name: NEW Environment Approval Workflow

on:
  push:
    branches:
      - main

jobs:
   
  deploy:
    name: Deploy to Environments
    runs-on: ubuntu-latest
    needs: auto_approve
    strategy:
      matrix:
        environment: [item1, item2]

    environment: ${{ matrix.environment }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      # Add steps to build and package your application

      - name: Deploy to ${{ matrix.environment }} environment
        run: |
          echo "I run post approval for ${{ matrix.environment }}"

  auto_approve:
    runs-on: ubuntu-latest
    steps:
      - name: Auto Approve Deploys
        # you can use any @vN.N.N tag from https://github.com/activescott/automate-environment-deployment-approval/releases
        uses: activescott/automate-environment-deployment-approval@main
        with:
          github_token: ${{ secrets.GH_TOKEN_FOR_AUTO_APPROVING_DEPLOYS }}
          environment_allow_list: |
            item1
            item2
          # The below automatically approves dependabot and anything submitted by the Github user with login "activescott"
          actor_allow_list: |
            dependabot[bot]          
            mohtashims    

The logs clearly says that auto-approval is registered for both item1 and item2

Run activescott/automate-environment-deployment-approval@main
input environments_to_approve: [ 'item1', 'item2' ]
input actors_to_approve: [ 'dependabot[bot]', 'mohtashims' ]
Deployment 'Update main.yml' (8224974043) to environment 'item1' will be approved...
Deployment 'Update main.yml' (8224974044) to environment 'item1' will be approved...
Notice: Found 2 deploys that should be approved...
Approving deployment to item1 triggered by mohtashims for run Update main.yml...
Notice: Approved deployment to item1 triggered by mohtashims for run Update main.yml.
Approving deployment to item1 triggered by mohtashims for run Update main.yml...
Notice: Approved deployment to item1 triggered by mohtashims for run Update main.yml.

As you see in the snapshot below its past 9 minutes and both item1 and item2 do not get auto-approved is the issue I'm reporting here.

enter image description here

Am I missing anything? Kindly suggest.

I feel there could be an issue with the third-party workflow for auto-approval out of our scope.

Eventually, my objective would be to get partial approval done using auto-approval like only item2 and not item1 Could you suggest a different solution for auto-approval to work?

0

There are 0 answers