Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ephemeral Environment Workflow | |
on: | |
pull_request: | |
types: | |
- labeled | |
jobs: | |
spin_up_deployment: | |
if: github.event.label.name == 'ephemeral' | |
name: Spin Up Ephemeral Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Show GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Trigger GitHub Deployment | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.PAT }} | |
script: | | |
console.log("CONTEXT"); | |
console.log(context); | |
const response = await github.rest.repos.createDeployment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: context.payload.pull_request.head.ref, | |
environment: 'ephemeral', | |
description: 'Spinning up ephemeral environment', | |
transient_environment: true, | |
}); | |
console.log(`Deployment created with ID: ${response.data.id}`); |