Browse Source

Fix slash_commands workflow, regex and target branch

pull/1336/head
Ross McFarland 1 week ago
parent
commit
8857cc6151
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
1 changed files with 3 additions and 11 deletions
  1. +3
    -11
      .github/workflows/slash_commands.yml

+ 3
- 11
.github/workflows/slash_commands.yml View File

@ -21,10 +21,8 @@ jobs:
command_body="${{ github.event.comment.body }}"
# Remove the command prefix to get the arguments
# The regex 's' modifier allows the dot to match newlines
# and the 'm' modifier allows '^' to match at the beginning of each line
# This handles commands spanning multiple lines
parsed_body=$(echo "$command_body" | sed -E 's/\/changelog create -t ([a-z]+) (.*)$/\1|\2/')
# Handles both -t and --type flag formats
parsed_body=$(echo "$command_body" | sed -E 's/\/changelog create (-t|--type) ([a-z]+) (.*)$/\2|\3/')
# The parsed output will be 'type|message'
changelog_type=$(echo "$parsed_body" | cut -d'|' -f1)
@ -57,12 +55,6 @@ jobs:
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
sha=$(git rev-parse HEAD)
echo "sha=$sha"
# the origin one is where we need to push to, other two aren't useful
branch=$(git branch --all --contains $SHA | grep origin | sed 's#^.*origin/##;s/[[:space:]]*$//')
echo "branch=$branch"
./script/changelog create -c -t "${{ steps.parse_command.outputs.changelog_type }}" "${{ steps.parse_command.outputs.message }}"
git push origin HEAD:"$branch"
git push origin HEAD:refs/pull/${{ github.event.issue.number }}/head

Loading…
Cancel
Save