-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmanual_add.sh
executable file
·74 lines (65 loc) · 1.97 KB
/
manual_add.sh
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/env bash
source $(dirname "${BASH_SOURCE[0]}")/base.sh
function get-lctt-head()
{
(
cd $(get-lctt-path)
local remote_user=$(git-get-remote-user origin)
local current_branch=$(git-get-current-branch)
echo "${remote_user}:${current_branch}"
)
}
function get-lctt-last-commit-title()
{
(
cd $(get-lctt-path)
git log -1 --format="format:%s"|head -n 1
)
}
function get-lctt-operation-file()
{
(
cd $(get-lctt-path)
local current_branch=$(git-get-current-branch)
git-branch-to-file-path "${current_branch}"
)
}
function is-valid-file()
{
(
cd $(get-lctt-path)
local operation_file="$*"
local file_size=$(cat "${operation_file}"|wc -w)
# 文件字数达到500字才认为是有效文章
[[ ${file_size} -gt 500 ]] && grep '^\[#\]: author: ' "${operation_file}" |grep "http"
)
}
function auto-pull-request()
{
local added_file=$(get-lctt-operation-file)
if is-valid-file "${added_file}";then
echo "${added_file} 文件是有效文件,自动提交"
ok.sh create_pull_request "LCTT/TranslateProject" "$(get-lctt-last-commit-title)" "$(get-lctt-head)" "master"
else
echo "${added_file} 文件不是有效文件,不自动提交"
fi
}
# feeds = ("https://feeds.feedburner.com/kerneltalks", "https://www.datamation.com/rss.xml", "http://lukasz.langa.pl/feed/recent/rss-en.xml", "https://feeds.feedburner.com/LinuxUprising", "https://linuxaria.com/feed", )
# feeds="https://opensource.com/feed"
# for feed in ${feeds};do
# echo "auto add ${feed}"
# ./feed_monitor.py "${feed}" |while read url
# do
# yes "
# "|./1_add_new_article_manual.sh -u "${url}"
# ./4_finish.sh -d
# done
# done
feed="http://feeds.feedburner.com/Ostechnix"
proxychains ./feed_monitor.py "${feed}" |while read url
do
yes "
"|./1_add_new_article_manual.sh -u "${url}" -c tech
auto-pull-request
./4_finish.sh -d
done