-
Notifications
You must be signed in to change notification settings - Fork 10
56 lines (51 loc) · 1.65 KB
/
rfd-bot.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: RFD Bot
# TODO debug this with the first RFD going through the automation: RFD 0002
on:
workflow_dispatch:
push:
branches:
- rfd/*
paths:
- "rfd/**"
- ".github/workflows/rfd-bot.yaml"
jobs:
claim-rfd-number:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# we only need the head
fetch-depth: 0
ref: main
- name: Set RFD Number
run: |
RFD_NUMBER=$(echo ${{ github.ref }} | sed 's/refs\/heads\/rfd\///')
echo "Found RFD Number: $RFD_NUMBER from branch name"
echo "RFD_NUMBER=$RFD_NUMBER" >> $GITHUB_ENV
- name: Claim RFD number if available
run: |
if [ ! -d "rfd/${RFD_NUMBER}" ]; then
echo "Attempting to claim RFD ${RFD_NUMBER}..."
mkdir "rfd/${RFD_NUMBER}"
touch "rfd/${RFD_NUMBER}/README.mdx"
echo "RFD_CLAIMED=true" >> $GITHUB_ENV
else
echo "RFD ${RFD_NUMBER} already exists, skipping..."
fi
- uses: EndBug/add-and-commit@v9
if: env.RFD_CLAIMED == 'true'
with:
add: "rfd"
author_name: "🤖 RFD Bot"
message: "chore(rfd): 🤖 claim RFD ${{ env.RFD_NUMBER }}"
notify-slack-on-failure:
needs: [claim-rfd-number]
runs-on: ubuntu-latest
if: failure() && github.ref == 'refs/heads/main'
steps:
- name: Notify Slack on failure
uses: 514-labs/[email protected]
with:
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-webhook-url: ${{ secrets.SLACK_GITHUB_ACTIONS_WEBHOOK_URL }}