Harsha Maddi
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
67 additions and
1 deletions
-
.github/workflows/wiki-monitor.yml
-
acme.sh
|
|
@ -0,0 +1,60 @@ |
|
|
|
name: Notify via Issue on Wiki Edit |
|
|
|
|
|
|
|
on: |
|
|
|
gollum: |
|
|
|
|
|
|
|
jobs: |
|
|
|
notify: |
|
|
|
runs-on: ubuntu-latest |
|
|
|
steps: |
|
|
|
- name: Checkout wiki repository |
|
|
|
uses: actions/checkout@v4 |
|
|
|
with: |
|
|
|
repository: ${{ github.repository }}.wiki |
|
|
|
path: wiki |
|
|
|
|
|
|
|
- name: Generate wiki change message |
|
|
|
run: | |
|
|
|
actor="${{ github.actor }}" |
|
|
|
sender_url=$(jq -r '.sender.html_url' "$GITHUB_EVENT_PATH") |
|
|
|
page_name=$(jq -r '.pages[0].page_name' "$GITHUB_EVENT_PATH") |
|
|
|
page_sha=$(jq -r '.pages[0].sha' "$GITHUB_EVENT_PATH") |
|
|
|
page_url=$(jq -r '.pages[0].html_url' "$GITHUB_EVENT_PATH") |
|
|
|
page_action=$(jq -r '.pages[0].action' "$GITHUB_EVENT_PATH") |
|
|
|
now="$(date '+%Y-%m-%d %H:%M:%S')" |
|
|
|
|
|
|
|
cd wiki |
|
|
|
prev_sha=$(git rev-list $page_sha^ -- "$page_name.md" | head -n 1) |
|
|
|
if [ -n "$prev_sha" ]; then |
|
|
|
git diff $prev_sha $page_sha -- "$page_name.md" > ../wiki.diff || echo "(No diff found)" > ../wiki.diff |
|
|
|
else |
|
|
|
echo "(no diff)" > ../wiki.diff |
|
|
|
fi |
|
|
|
cd .. |
|
|
|
{ |
|
|
|
echo "Wiki edited" |
|
|
|
echo -n "User: " |
|
|
|
echo "[$actor]($sender_url)" |
|
|
|
echo "Time: $now" |
|
|
|
echo "Page: [$page_name]($page_url) (Action: $page_action)" |
|
|
|
echo "" |
|
|
|
echo "----" |
|
|
|
echo "### diff:" |
|
|
|
echo '```diff' |
|
|
|
cat wiki.diff |
|
|
|
echo '```' |
|
|
|
} > wiki-change-msg.txt |
|
|
|
|
|
|
|
- name: Create issue to notify Neilpang |
|
|
|
uses: peter-evans/create-issue-from-file@v5 |
|
|
|
with: |
|
|
|
title: "Wiki edited" |
|
|
|
content-filepath: ./wiki-change-msg.txt |
|
|
|
assignees: Neilpang |
|
|
|
env: |
|
|
|
TZ: Asia/Shanghai |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1401,6 +1401,12 @@ _ss() { |
|
|
|
return 0 |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "$(uname)" = "AIX" ]; then |
|
|
|
_debug "Using: AIX netstat" |
|
|
|
netstat -an | grep "^tcp" | grep "LISTEN" | grep "\.$_port " |
|
|
|
return 0 |
|
|
|
fi |
|
|
|
|
|
|
|
if _exists "netstat"; then |
|
|
|
_debug "Using: netstat" |
|
|
|
if netstat -help 2>&1 | grep "\-p proto" >/dev/null; then |
|
|
@ -2802,7 +2808,7 @@ _initAPI() { |
|
|
|
_request_retry_times=0 |
|
|
|
while [ -z "$ACME_NEW_ACCOUNT" ] && [ "${_request_retry_times}" -lt "$MAX_API_RETRY_TIMES" ]; do |
|
|
|
_request_retry_times=$(_math "$_request_retry_times" + 1) |
|
|
|
response=$(_get "$_api_server") |
|
|
|
response=$(_get "$_api_server" "" 10) |
|
|
|
if [ "$?" != "0" ]; then |
|
|
|
_debug2 "response" "$response" |
|
|
|
_info "Cannot init API for: $_api_server." |
|
|
|