Skip to content

As a shop owner I can bulk pause all payment collections across all my subscribers #175

As a shop owner I can bulk pause all payment collections across all my subscribers

As a shop owner I can bulk pause all payment collections across all my subscribers #175

name: Auto create git branch upon new issue
on:
issues:
types: [opened, reopened]
jobs:
create-issue-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get issue number and title
id: issue
run: |
echo "::set-output name=number::${{ github.event.issue.number }}"
echo "::set-output name=title::${{ github.event.issue.title }}"
# Sanitize issue title to:
# - alnum
# - replace spaces with hyphen '-'
# Example:
# Given an issue title: "Fix the 2'nd bug in UI where there's a # in the form"
# Becomes:
#
# Note there is a space here, to keep both '-' and spaces ' '
echo ISSUE_BRANCH_NAME=`echo "${{ github.event.issue.title }}" | \
# Remove non alpha/numeric chars
tr -cd '[:alnum:]- ' | \
# Convert spaces to hyphens '-'
tr ' ' '-' | \
# Ensure lowercase branch name
tr '[:upper:]' '[:lower:]' | \
# Limit branch name to 60 characters
cut -c -60` >> $GITHUB_ENV
ALLOWED_BRANCH_NAME_CHARS='[^a-zA-Z0-9-]'
# Loop through each character in the branch name, replacing any not allowed characer with a hyphen '-'
while [[ $ISSUE_BRANCH_NAME =~ $ALLOWED_BRANCH_NAME_CHARS ]]; do
ISSUE_BRANCH_NAME=`echo $ISSUE_BRANCH_NAME | sed -r "s/($ALLOWED_BRANCH_NAME_CHARS)/-/g" | sed 's/--/-/g'`
done
echo $ISSUE_BRANCH_NAME >> $GITHUB_ENV
- name: Create new branch
run: |
echo "The issue branch name is ${{ env.ISSUE_BRANCH_NAME}} "
git checkout -b "${{ steps.issue.outputs.number }}-${{ env.ISSUE_BRANCH_NAME }}"
git push -u origin HEAD