Skip to content

fix pre-commit-config.yaml filename #3

fix pre-commit-config.yaml filename

fix pre-commit-config.yaml filename #3

name: Notify PR Status
on:
pull_request:
types: [opened, closed]
branches:
- main
pull_request_review:
types: [submitted]
env:
ACTOR: ${{ github.actor }}
PR_NAME: ${{ github.event.pull_request.title }}
PR_BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_AUTHOR_URL: ${{ github.event.pull_request.user.html_url }}
PR_APPROVER: ${{ github.event.review.user.login }}
REPO: ${{ github.repository }}
REPO_URL: ${{ github.event.repository.html_url }}
jobs:
notify-opened:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'opened' && github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- name: Generate message
id: generate-message
run: |
bash templates/slack-notify-pr-opened.tpl
cat slack_message | awk '{printf "%s\\n", $0}' > slack_message.stripped
BODY=$(cat slack_message.stripped)
echo "payload=$BODY" >> $GITHUB_OUTPUT
- name: Post to Slack
uses: rise8-us/cato-playbook/.github/actions/post-to-slack@main
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
message: ${{ steps.generate-message.outputs.payload }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
notify-approved:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request_review' && github.event.review.state == 'approved'
steps:
- uses: actions/checkout@v4
- name: Generate message
id: generate-message
run: |
bash templates/slack-notify-pr-approved.tpl
cat slack_message | awk '{printf "%s\\n", $0}' > slack_message.stripped
BODY=$(cat slack_message.stripped)
echo "payload=$BODY" >> $GITHUB_OUTPUT
- name: Post to Slack
uses: rise8-us/cato-playbook/.github/actions/post-to-slack@main
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
message: ${{ steps.generate-message.outputs.payload }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
notify-closed:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged
steps:
- uses: actions/checkout@v4
- name: Generate message
id: generate-message
run: |
bash templates/slack-notify-pr-closed.tpl
cat slack_message | awk '{printf "%s\\n", $0}' > slack_message.stripped
BODY=$(cat slack_message.stripped)
echo "payload=$BODY" >> $GITHUB_OUTPUT
- name: Post to Slack
uses: rise8-us/cato-playbook/.github/actions/post-to-slack@main
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
message: ${{ steps.generate-message.outputs.payload }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}