Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/discord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:

notify_push:
uses: ./.github/workflows/discord_push.yml
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'Merge pull request')
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this check here because the workflow is used for both push and pull_request triggers.

with:
branch_name: 'main'
branch_name: ${{ github.ref }}
commit_message: ${{ github.event.head_commit.message }}
commit_url: ${{ github.event.head_commit.url }}
repo_full_name: ${{ github.repository }}
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/discord_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: 'Branch name'
type: string
required: false
default: 'main'
default: 'refs/heads/main'
commit_message:
description: 'Commit message'
type: string
Expand All @@ -30,9 +30,23 @@ jobs:
notify_push:
runs-on: ubuntu-latest
steps:
- name: Input check
id: input_check
run: |
GITHUB_REF="${{ inputs.branch_name }}"
echo "branch_name=${GITHUB_REF//refs\/heads\//}" >> $GITHUB_OUTPUT

COMMITTER_EMAIL="$(git show --pretty="format:%ce" --no-patch "$GITHUB_REF")"
if [[ "$COMMITTER_EMAIL" != "noreply@github.com" ]]; then
echo "is_direct_commit=true" >> $GITHUB_OUTPUT
else
echo "is_direct_commit=false" >> $GITHUB_OUTPUT
fi

- name: Send push notification to Discord
if: steps.input_check.outputs.is_direct_commit == 'true'
env:
BRANCH_NAME: ${{ inputs.branch_name }}
BRANCH_NAME: ${{ steps.input_check.outputs.branch_name }}
COMMIT_MESSAGE: ${{ inputs.commit_message }}
COMMIT_URL: ${{ inputs.commit_url }}
REPO_FULL_NAME: ${{ inputs.repo_full_name }}
Expand Down