Skip to content

Commit

Permalink
feat: push event (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekRoberts authored Dec 6, 2023
1 parent 060103d commit 07cd547
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ concurrency:
jobs:
# Dump GitHub Context.Event
dump:
name: Dump GitHub Context.Event
name: Event details
runs-on: ubuntu-22.04
steps:
- name: Dump GitHub Context.Event
run: echo "${{ toJson(github.event) }}" | sed -r 's/#/\\#/g'
- name: Event details
run: |
echo "github.event_name: ${{ github.event_name }}"
echo "github.event.action: ${{ github.event.action }}"
# Test for PR, merge queue and merge to main
get-pr:
Expand Down
16 changes: 15 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,23 @@ runs:
# Get PR number (different process for merge queue)
if [ ${{ github.event_name }} == 'pull_request' ]
then
echo "Event type: pull request"
pr=${{ github.event.number }}
else
elif [ ${{ github.event_name }} == 'merge_group' ]
then
echo "Event type: merge queue"
pr=$(echo ${{ github.event.merge_group.head_ref }} | grep -Eo "queue/main/pr-[0-9]+" | cut -d '-' -f2)
elif [ ${{ github.event_name }} == 'push' ]
then
echo "Event type: push"
pr=$(echo ${{ github.event.head_commit.message }} |( grep -Eo "pr-[0-9]+" || true )| cut -d '-' -f2)
if [ -z "${pr}" ]
then
echo "No PR number found. Was this push triggered by a squashed PR merge?"
pr=""
fi
else
echo "Event type: unknown or unexpected"
fi
echo "Summary ---"
Expand Down

0 comments on commit 07cd547

Please sign in to comment.