feat: clickhouse-buffer #168
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Campsite PR Alerts | |
on: | |
pull_request: | |
types: [opened, closed, merged, ready_for_review, reopened] | |
jobs: | |
post_to_campsite: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Post to Campsite | |
id: post_to_campsite | |
run: | | |
if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then | |
STATUS_EMOJI="⚪" | |
elif [[ "${{ github.event.action }}" == "opened" || "${{ github.event.action }}" == "reopened" || "${{ github.event.action }}" == "ready_for_review" ]]; then | |
STATUS_EMOJI="🟢" | |
elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged }}" == "true" ]]; then | |
STATUS_EMOJI="🟣" | |
elif [[ "${{ github.event.action }}" == "closed" ]]; then | |
STATUS_EMOJI="🔴" | |
fi | |
ACTION=${{ github.event.action }} | |
if [[ "${ACTION}" == "ready_for_review" ]]; then | |
ACTION="ready for review" | |
elif [[ "${ACTION}" == "reopened" ]]; then | |
ACTION="reopened" | |
elif [[ "${ACTION}" == "closed" && "${{ github.event.pull_request.merged }}" == "true" ]]; then | |
ACTION="merged" | |
fi | |
ESCAPED_TITLE=$(echo "${{ github.event.pull_request.title }}" | jq -Rr @json) | |
CONTENT="${STATUS_EMOJI} Pull request ${ACTION} by ${{ github.event.pull_request.user.login }}: [#${{ github.event.pull_request.number }} ${ESCAPED_TITLE}](${{ github.event.pull_request.html_url }})" | |
echo "content=${CONTENT}" >> $GITHUB_OUTPUT | |
- name: Create Campsite message | |
uses: campsite/campsite-github-action@v1 | |
with: | |
api_key: ${{ secrets.CAMPSITE_API_KEY }} | |
action_type: create_message | |
thread_id: ${{ secrets.CAMPSITE_PR_ALERTS_THREAD_ID }} | |
content: ${{ steps.post_to_campsite.outputs.content }} |