Skip to content

chore(deps): bump micromatch from 4.0.7 to 4.0.8 #102

chore(deps): bump micromatch from 4.0.7 to 4.0.8

chore(deps): bump micromatch from 4.0.7 to 4.0.8 #102

name: Remove PR Previews
on:
pull_request:
types: [closed]
concurrency: preview-teardown-${{ github.ref }}
jobs:
list-environments:
runs-on: ubuntu-latest
outputs:
hasNextJs13Env: ${{ steps.list-environments.outputs.hasNextJs13Env }}
hasNextJs14Env: ${{ steps.list-environments.outputs.hasNextJs14Env }}
hasNuxtEnv: ${{ steps.list-environments.outputs.hasNuxtEnv }}
hasVanillaJsEnv: ${{ steps.list-environments.outputs.hasVanillaJsEnv }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: List repo environments
id: list-environments
uses: actions/github-script@v6
with:
github-token: ${{ secrets.PIE_BOT_TOKEN }}
script: |
const pullRequestNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
console.log(`Pull Request Number: ${pullRequestNumber}`);
// List environments
const { data: { environments } } = await github.rest.repos.getAllEnvironments({
owner: owner,
repo: repo,
per_page: 100,
});
const envList = environments.map(env => env.name);
console.log('Environment List:', envList);
// Check for existence of specific environments
const hasNextJs13Env = envList.includes(`nextjs-app-v13-pr-${pullRequestNumber}`);
const hasNextJs14Env = envList.includes(`nextjs-app-v14-pr-${pullRequestNumber}`);
const hasNuxtEnv = envList.includes(`nuxt-app-pr-${pullRequestNumber}`);
const hasVanillaJsEnv = envList.includes(`vanilla-app-pr-${pullRequestNumber}`);
console.log('Has NextJS 13 Env:', hasNextJs13Env);
console.log('Has NextJS 14 Env:', hasNextJs14Env);
console.log('Has Nuxt Env:', hasNuxtEnv);
console.log('Has VanillaJS Env:', hasVanillaJsEnv);
core.setOutput('hasNextJs13Env', hasNextJs13Env ? 'true' : 'false');
core.setOutput('hasNextJs14Env', hasNextJs14Env ? 'true' : 'false');
core.setOutput('hasNuxtEnv', hasNuxtEnv ? 'true' : 'false');
core.setOutput('hasVanillaJsEnv', hasVanillaJsEnv ? 'true' : 'false');
- name: Delete associated NextJS 13 app environment
if: ${{ steps.list-environments.outputs.hasNextJs13Env == 'true' }}
uses: ./.github/actions/amplify-teardown
with:
github-token: ${{ secrets.PIE_BOT_TOKEN }}
amplify-app-id: d1106vmj1ozg8d
aws-region: 'eu-west-1'
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
environment-name: nextjs-app-v13-pr-${{ github.event.pull_request.number }}
branch-name: 'pr${{ github.event.pull_request.number }}'
- name: Delete associated NextJS 14 app environment
if: ${{ steps.list-environments.outputs.hasNextJs14Env == 'true' }}
uses: ./.github/actions/amplify-teardown
with:
github-token: ${{ secrets.PIE_BOT_TOKEN }}
amplify-app-id: d1xxjuy6vbm7pk
aws-region: 'eu-west-1'
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
environment-name: nextjs-app-v14-pr-${{ github.event.pull_request.number }}
branch-name: 'pr${{ github.event.pull_request.number }}'
- name: Delete associated Nuxt app environment
if: ${{ steps.list-environments.outputs.hasNuxtEnv == 'true' }}
uses: ./.github/actions/amplify-teardown
with:
github-token: ${{ secrets.PIE_BOT_TOKEN }}
amplify-app-id: d36dan3bxjue8c
aws-region: 'eu-west-1'
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
environment-name: nuxt-app-pr-${{ github.event.pull_request.number }}
branch-name: 'pr${{ github.event.pull_request.number }}'
- name: Delete associated Vanilla app environment
if: ${{ steps.list-environments.outputs.hasVanillaJsEnv == 'true' }}
uses: ./.github/actions/amplify-teardown
with:
github-token: ${{ secrets.PIE_BOT_TOKEN }}
amplify-app-id: d2vb6sjgivffb3
aws-region: 'eu-west-1'
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
environment-name: vanilla-app-pr-${{ github.event.pull_request.number }}
branch-name: 'pr${{ github.event.pull_request.number }}'