Skip to content

Instantly share code, notes, and snippets.

@keithrozario
Last active July 26, 2024 21:15
Show Gist options
  • Save keithrozario/6f0031111f71d1569ffb0c1e515a236c to your computer and use it in GitHub Desktop.
Save keithrozario/6f0031111f71d1569ffb0c1e515a236c to your computer and use it in GitHub Desktop.
Get branch name on branch delete github actions
name: Serverless Delete example
on:
delete:
branches:
- actions-**
# Specify what jobs to run
jobs:
deploy:
name: delete
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- uses: actions/checkout@v1
- name: Github context
run: echo "${{ toJson(github) }}"
- name: Set Branch name
run: |
BRANCH=$(cat ${{ github.event_path }} | jq --raw-output '.ref')
echo "${{ github.repository }} has ${BRANCH} branch"
echo "::set-env name=STAGE::$(echo ${BRANCH})"
- name: Echo Branch name
run: echo Deleting from STAGE:$STAGE
# Install npm and it's dependencies
- name: npm install dependencies
run: npm install
# sls remove
- name: Serverless
uses: serverless/[email protected]
with:
args: remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment