Terraform plan on PR vs apply on merge failing with state lock errors

We’re trying to implement a CI/CD pipeline using GitHub Actions for Genesys Cloud CX as Code. The workflow runs terraform plan on pull requests and terraform apply on merges to main. We keep hitting state lock errors because the plan job and apply job might run concurrently or the plan job doesn’t release the lock properly. Here is the relevant workflow snippet:

jobs:
 plan:
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v2
 - run: terraform plan -out=tfplan

How do we handle the state lock for the plan job so it doesn’t block the apply job later?