Skip to content

Instantly share code, notes, and snippets.

@keithrozario
Last active November 8, 2023 19:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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/github-action@v1.53.0
with:
args: remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment