domjtalbot/nx-mesh

View on GitHub
.github/workflows/delete-cache.yml

Summary

Maintainability
Test Coverage
name: 'Delete Cache'

on:
  pull_request:
    types: [closed]

  workflow_dispatch:
    inputs:
      branchName:
        type: string
        required: false
        description: >
          The branch to clear cache for.

      pullRequestId:
        type: number
        required: false
        description: >
          The pull request ID to clear cache for.

jobs:
  deletePullRequest:
    if: ${{ github.event.number || inputs.pullRequestId }}
    runs-on: ubuntu-latest
    steps:
      - uses: snnaplab/delete-branch-cache-action@v1
        with:
          # Specify explicitly because the ref at the time of merging will be a branch name such as 'main', 'develop'
          ref: refs/pull/${{ github.event.number || inputs.pullRequestId }}/merge

  deleteBranch:
    if: ${{ inputs.branchName }}
    runs-on: ubuntu-latest
    steps:
      - uses: snnaplab/delete-branch-cache-action@v1
        with:
          ref: refs/heads/${{ inputs.branchName }}