Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ runs:
id: check_event
shell: bash
run: |
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "is_pr=true" >> $GITHUB_OUTPUT
else
echo "is_pr=false" >> $GITHUB_OUTPUT
echo "Not a pull request event. Skipping action."
exit 0
fi
echo "This is a pull request event."

- name: Check if PR head branch matches allowed patterns
id: check_branch
if: steps.check_event.outputs.is_pr == 'true'
shell: bash
run: |
HEAD_BRANCH="${{ github.event.pull_request.head.ref }}"
Expand Down Expand Up @@ -67,6 +69,7 @@ runs:

- name: Generate comment message
id: generate_comment
if: steps.check_event.outputs.is_pr == 'true' && (steps.check_branch.outputs.branch_allowed == 'true' || steps.check_branch.outputs.branch_allowed == '')
shell: bash
run: |
{
Expand All @@ -82,6 +85,7 @@ runs:
} >> "$GITHUB_OUTPUT"

- name: Comment on PR
if: steps.check_event.outputs.is_pr == 'true' && (steps.check_branch.outputs.branch_allowed == 'true' || steps.check_branch.outputs.branch_allowed == '')
uses: thollander/actions-comment-pull-request@v2
with:
message: ${{ steps.generate_comment.outputs.comment }}
Expand Down