Skip to content

Instantly share code, notes, and snippets.

@raclim
Created March 8, 2024 20:00
Show Gist options
  • Save raclim/f5ffce82dd2c25382d1ea890b12cc3d7 to your computer and use it in GitHub Desktop.
Save raclim/f5ffce82dd2c25382d1ea890b12cc3d7 to your computer and use it in GitHub Desktop.
// draft a github action for creating ephemeral environments on PRs???
name: Build emphemeral environment for PRs
on:
pull_request:
types: [opened, reopened]
branches:
- develop
jobs:
create_ephemeral_environment:
runs-on: ubuntu-latest
name: Emphemeral environment
steps:
- name: Checkout PR code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Push to temporary branch
run:
git config --global user.email "email?"
git config --global user.name "username?"
git checkout -b temp-branch-for-pr-${{ github.event.pull_request.number }}
git push origin temp-branch-for-pr-${{ github.event.pull_request.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
// Potential Workflow Steps
// checkout and clone PR branch from forked repository
// configure Release to deploy from these temporary branches
// ensure updates to pull request are added to the environment
// delete branch and teardown environment once PR is closed? - this might be a separate workflow
// Questions
// How do I get release to automatically detect this branch was created? should i create another pull request with this branch?
// Resources
// checkout github action from forked repo https://github.com/actions/checkout/issues/551
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment