File tree Expand file tree Collapse file tree 2 files changed +75
-0
lines changed
Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # This section loads configuration files needed to set environment variables
4+ # such as GITHUB_TOKEN. If these variables are already exported globally in the shell,
5+ # the files below can remain commented out. Otherwise, uncomment the appropriate
6+ # file(s) as needed. This particular script only needs GITHUB_TOKEN to function properly.
7+
8+ # source "$GITNAP/utils/auth.sh"
9+ # source "$GITNAP/utils/settings.sh"
10+
11+
12+
13+ function delete_github_notifications() {
14+ local NOTIFICATION_ID
15+ local endpoint
16+ local response
17+ local tmp_file
18+
19+ NOTIFICATION_ID=" $1 "
20+
21+ # Checks if the parameter was provided.
22+ if [[ -z " $NOTIFICATION_ID " ]]; then
23+ echo " Provide id notification to delete"
24+ exit 1
25+ fi
26+
27+ # API Endpoint
28+ endpoint=" https://api.github.com/notifications/threads/$NOTIFICATION_ID "
29+
30+ # Delete notifications
31+ response=$( curl -sSL -X DELETE " $endpoint " \
32+ -H " Accept: application/vnd.github+json" \
33+ -H " Authorization: Bearer $GITHUB_TOKEN " \
34+ -H " X-GitHub-Api-Version: 2022-11-28" )
35+
36+ echo " $response "
37+
38+ }
39+
40+ delete_github_notifications " $1 "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # This section loads configuration files needed to set environment variables
4+ # such as GITHUB_TOKEN. If these variables are already exported globally in the shell,
5+ # the files below can remain commented out. Otherwise, uncomment the appropriate
6+ # file(s) as needed. This particular script only needs GITHUB_TOKEN to function properly.
7+
8+ # source "$GITNAP/utils/auth.sh"
9+ # source "$GITNAP/utils/settings.sh"
10+
11+
12+
13+ function list_github_notifications() {
14+ local endpoint
15+ local response
16+ local tmp_file
17+
18+ # API Endpoint
19+ endpoint=" https://api.github.com/notifications"
20+
21+ # Get notifications
22+ response=$( curl -sSL " $endpoint " \
23+ -H " Accept: application/vnd.github+json" \
24+ -H " Authorization: Bearer $GITHUB_TOKEN " \
25+ -H " X-GitHub-Api-Version: 2022-11-28" )
26+
27+ # See in terminal
28+ tmp_file=$( mktemp)
29+ echo " $response " > " $tmp_file "
30+ less " $tmp_file "
31+ rm " $tmp_file "
32+
33+ }
34+
35+ list_github_notifications
You can’t perform that action at this time.
0 commit comments