-
Notifications
You must be signed in to change notification settings - Fork 0
revert(github): switch to using github slack integration subscription #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Slack Pull Request Notification | ||
| on: | ||
| pull_request: | ||
| types: [opened] | ||
|
|
||
| jobs: | ||
| pr-title: | ||
| name: Validate PR Title | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'pull_request' | ||
| permissions: | ||
| pull-requests: read | ||
| steps: | ||
| - uses: amannn/action-semantic-pull-request@v5 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| types: | | ||
| feat | ||
| fix | ||
| docs | ||
| style | ||
| refactor | ||
| perf | ||
| test | ||
| build | ||
| ci | ||
| chore | ||
| revert | ||
| requireScope: true | ||
| notify: | ||
| name: PR Slack Notification | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Escape PR title | ||
| id: pr_data | ||
| run: | | ||
| # Get the PR title and escape special characters for JSON (needed for Reverts Commits) | ||
| PR_TITLE='${{ github.event.pull_request.title }}' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Command injection via PR title in shell scriptHigh Severity The PR title is directly interpolated into the shell script using |
||
| # Properly escape JSON special characters and quotes | ||
| ESCAPED_TITLE=$(echo "$PR_TITLE" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | sed 's/\t/\\t/g' | sed 's/\n/\\n/g' | sed 's/\r/\\r/g') | ||
| echo "escaped_title=$ESCAPED_TITLE" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Notify Slack | ||
| uses: slackapi/slack-github-action@v2.1.0 | ||
| with: | ||
| webhook-type: incoming-webhook | ||
| webhook: ${{ secrets.SLACK_PULL_REQUEST_WEBHOOK_URL }} | ||
| payload: | | ||
| text: "New PR: ${{ steps.pr_data.outputs.escaped_title }}\nBy: ${{ github.event.pull_request.user.login }}\nLink: ${{ github.event.pull_request.html_url }}" | ||
|
|
||
This file was deleted.


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant conditional check for event type
Low Severity
The
if: github.event_name == 'pull_request'condition is redundant because the workflow is already configured to only trigger onpull_requestevents (lines 2-4). This condition will always evaluate to true when the workflow runs.