Skip to content

Instantly share code, notes, and snippets.

View remarkablemark's full-sized avatar

Mark remarkablemark

View GitHub Profile
- name: Copy environment variables to Heroku app
if: github.event.action == 'opened'
run: |
heroku config --shell --app=my-development-app > .env
cat .env | tr '\n' ' ' | xargs heroku config:set --app=${{ env.HEROKU_APP_NAME }}
- name: Add Heroku app to pipeline
if: github.event.action == 'opened'
run: heroku pipelines:add my-pipeline --app=${{ env.HEROKU_APP_NAME }} --stage=development
- name: Create Heroku app
if: github.event.action == 'opened'
run: heroku apps:create ${{ env.HEROKU_APP_NAME }}
- name: Login to Heroku
uses: akhileshns/heroku-deploy@v3.12.12
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_email: user@example.com
heroku_app_name: ${{ env.HEROKU_APP_NAME }}
justlogin: true
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
jobs:
heroku-pull-request:
runs-on: ubuntu-latest
env:
HEROKU_APP_NAME: my-app-pr-${{ github.event.number }}
steps:
# ...
name: Heroku Pull Request
on:
pull_request:
types: [opened, synchronize, reopened, closed]
# shut down redis-server (if applicable)
REDIS_SERVER_PID_FILE=/tmp/redis-server.pid
(kill $(cat $REDIS_SERVER_PID_FILE) 2>&1) >/dev/null
sleep 0.1
# start redis-server
nohup redis-server redis.conf >/dev/null 2>&1 &
sleep 0.1
echo $! > $REDIS_SERVER_PID_FILE
const stream = redis.scanStream({ match: '*' });
let keys = [];
stream.on('data', (resultKeys) => {
keys = keys.concat(resultKeys);
});
stream.on('end', () => {
console.log(keys); // returns ['key']