-
Notifications
You must be signed in to change notification settings - Fork 3
47 lines (37 loc) · 1.31 KB
/
discussion_creation.yml
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
name: Discussion Creation on New Folder
on:
push:
paths:
- '**/'
jobs:
create_discussion:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Check for added folders
id: check_folders
run: |
ADDED_FOLDERS=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '/' | awk -F/ '{print $1}' | uniq)
if [ -z "$ADDED_FOLDERS" ]; then
echo "No new folders added."
echo "::set-output name=status::skipped"
else
echo "New folders detected: $ADDED_FOLDERS"
echo "::set-output name=status::found"
echo "::set-output name=folders::$ADDED_FOLDERS"
fi
- name: Setup the GitHub CLI
uses: actions4gh/setup-gh@v1.0.2
- name: Authenticate with GitHub token
run: gh auth login --with-token ${{ secrets.ACTIONS }}
- name: Create a new GitHub Discussion
id: create-discussion
uses: abirismyname/create-discussion@v1.x
env:
GH_TOKEN: ${{ secrets.ACTIONS }}
if: steps.check_folders.outputs.status == 'found'