Skip to content

Commit

Permalink
OPS-5460 Moved branch filtering to reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncolincap committed Nov 13, 2023
1 parent e991e15 commit a99b0ff
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/filter-branch-name.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Filter branch name for ticket and scope

on:
workflow_call:
inputs:
branch_name:
description: "Branch name to filter"
required: true
type: string
outputs:
ticket:
type: string
value: ${{ jobs.job.outputs.ticket }}
scope:
type: string
value: ${{ jobs.job.outputs.ticket }}

jobs:
job:
runs-on: ubuntu-latest
outputs:
ticket: ${{ steps.step.outputs.ticket }}
scope: ${{ steps.step.outputs.scope }}
steps:
- name: Filter branch name
id: step
run: |
echo "ticket=$(echo ${{ inputs.branch_name }} | grep -oE '[a-zA-Z]+-[0-9]+')" >> $GITHUB_OUTPUT
echo "scope=$(echo ${{ inputs.branch_name }} | grep -oE '[a-zA-Z]+-[0-9]+-[a-z]+' | grep -oE '[a-z]+$')" >> $GITHUB_OUTPUT

0 comments on commit a99b0ff

Please sign in to comment.