Skip to content

Commit

Permalink
New
Browse files Browse the repository at this point in the history
  • Loading branch information
shejialuo committed Feb 6, 2023
0 parents commit 8d0fcac
Show file tree
Hide file tree
Showing 13 changed files with 468 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/scripts/new_weekly.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

WEEKLY_LOG="weekly.log"

MondayDate=`date "+%Y.%m.%d"`
FridayDate=`date "+%Y.%m.%d" --date "-4 days ago"`

MondayDateSplitArray=(${MondayDate//./ })
FridayDateSplitArray=(${FridayDate//./ })

directoryName="$MondayDate-$FridayDate"

directoryRootName=`date "+%Y.%m"`

if [[ -e "$directoryRootName/$directoryName/template.md" ]]; then
echo "The file already exists, exit"
exit 1
fi

mkdir -p "$directoryRootName/$directoryName"

cp Template/template.md "$directoryRootName/$directoryName"

fileName="$_/template.md"

week=`sed -n '3p' "${WEEKLY_LOG}"`

sed -i "2c title: '第${week}周工作汇报'" "$fileName"

let week=week+1
sed -i "3c ${week}" "${WEEKLY_LOG}"

markdownDate="${MondayDateSplitArray[0]}\
${MondayDateSplitArray[1]}\
${MondayDateSplitArray[2]}日-\
${FridayDateSplitArray[0]}\
${FridayDateSplitArray[1]}\
${FridayDateSplitArray[2]}"

sed -i "3c date: '${markdownDate}'" "$fileName"
60 changes: 60 additions & 0 deletions .github/scripts/submit_weekly.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

MondayDate=`date "+%Y.%m.%d" --date "6 days ago"`
FridayDate=`date "+%Y.%m.%d" --date "2 days ago"`

directoryName="$MondayDate-$FridayDate"
directoryRootName=`date "+%Y.%m" --date "6 days ago"`
fileName="$directoryRootName/$directoryName/template.md"
fileCopyName="$directoryRootName/$directoryName/template_copy.md"

cp "$fileName" "$fileCopyName"

markdownAttachmentResult=`sed -n '/^\[.\+/p' $fileName`
readarray -t markdownAttachment <<< "$markdownAttachmentResult"

markdownAttachmentLineNumberResult=`sed -n '/^\[.\+/=' $fileName`
readarray -t markdownAttachmentLineNumber <<< "$markdownAttachmentLineNumberResult"

attachmentNumber="${#markdownAttachment[@]}"

declare -a attachments
declare -a attachmentCopy
declare -a attachmentToAddToGit

for i in `seq 1 "$attachmentNumber"`; do
let j=i-1
subStringLeft=${markdownAttachment[j]#*(}
attachments[$j]=${subStringLeft%)*}
done

if [[ ! -z "$markdownAttachmentResult" ]] ;then
for i in `seq 1 "$attachmentNumber"`; do
let j=i-1
if [[ ! -e "$directoryRootName/$directoryName/${attachments[j]}" ]]; then
echo "The attachment file doesn't exist"
exit 1
fi
subStringLeft=${markdownAttachment[j]#*[}
attachmentCopy[$j]="[$i.${subStringLeft%]*}]($i.${attachments[j]})"
sed -i "${markdownAttachmentLineNumber[j]}c ${attachmentCopy[j]}" "$fileCopyName"
attachmentToAddToGit[$j]=$i.${attachments[j]}
cp -r "$directoryRootName/$directoryName/${attachments[j]}" "$directoryRootName/$directoryName/$i.${attachments[j]}"
done
fi

outputFileName="$directoryRootName/$directoryName/0.$directoryName.docx"
/bin/pandoc --reference-doc=./Template/custom-reference.docx "$fileCopyName" -o "$outputFileName"

cd "$directoryRootName/$directoryName"

/bin/zip "$directoryName"AIOps周报.zip "${attachmentToAddToGit[@]}" "0.$directoryName.docx"

echo "WEEKLY_PATH="$directoryRootName/$directoryName"" >> $GITHUB_ENV
echo "WEEKLY_NAME="$directoryName"AIOps周报.zip" >> $GITHUB_ENV

git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add "$directoryName"AIOps周报.zip
git commit -m '[automated commit] Submit weekly'
git push
51 changes: 51 additions & 0 deletions .github/scripts/weixin_upload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/python3

import os
import requests

"""
This function uses the interface provided by weixin,
See https://developer.work.weixin.qq.com/document/path/91770#文件上传接口
See https://developer.work.weixin.qq.com/document/path/91770#文件类型
parameter:
key: the weixin bot key
attachment_path: the attachment path
return:
An exit status
"""
def send_file(key: str, attachment_path: str) -> int:
try:
file_data = {'file': open(attachment_path, 'rb')}
except FileNotFoundError:
print(f'Error: this is no such file {attachment_path}, crash')
return -1
get_file_descriptor_url = (f'https://qyapi.weixin.qq.com/cgi-bin/webhook/upload_media?'
f'key={key}&type=file')
response = requests.post(url=get_file_descriptor_url, files=file_data)
json_decode = response.json()
try:
media_id = json_decode['media_id']
except KeyError:
print(f'Error: upload file to get media_id fail, crash')
return -1
send_data = { "msgtype": "file",
"file": {"media_id": media_id}
}
send_file_url = (f'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?'
f'key={key}')
requests.post(url=send_file_url,json=send_data)
return 0

def main() -> None:
key = os.environ.get("WEIXIN_ROBOT")
attachment_path = os.environ.get("ATTACHMENT_NAME")
if key is None or attachment_path is None:
print('Error: cannot get environment variable, crash')
return
send_file(key, attachment_path)

if __name__ == '__main__':
main()
20 changes: 20 additions & 0 deletions .github/workflows/new-weekly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: New Weekly
on:
workflow_dispatch:
schedule:
- cron: '0 8 * * 1'
jobs:
new_weekly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run new weekly script
run: ./.github/scripts/new_weekly.sh
shell: bash
- name: Git commit
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add -A
git commit -m '[automated commit] Add new weekly'
git push
42 changes: 42 additions & 0 deletions .github/workflows/submit-weekly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Submit Weekly
on: [workflow_dispatch]
jobs:
submit_weekly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install the dependencies
run: |
sudo apt-get update
sudo apt-get install zip wget python3 python3-pip
sudo pip3 install requests
- name: Install the pandoc
run: |
wget https://github.com/jgm/pandoc/releases/download/2.17.1.1/pandoc-2.17.1.1-1-amd64.deb
sudo dpkg -i pandoc-2.17.1.1-1-amd64.deb
- name: Run submit weekly script
run: ./.github/scripts/submit_weekly.sh
shell: bash
- name: Send the email to big boss and little boss
# see https://github.com/dawidd6/action-send-mail
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.yandex.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: "${{env.WEEKLY_NAME}}"
to: ${{secrets.BIG_BOSS_EMAIL_ADDRESS}}
from: ${{secrets.MAIL_USERNAME}}
secure: true
html_body: file://./Template/email.md
cc: ${{secrets.LITTLE_BOSS_EMAIL_ADDRESS}}, ${{secrets.SELF_MAIL_ADDRESS}}
ignore_cert: true
convert_markdown: true
attachments: ./${{env.WEEKLY_PATH}}/${{env.WEEKLY_NAME}}
priority: normal
- name: Send the weekly zip to WeiXinWork
run: python3 ./.github/scripts/weixin_upload.py
env:
WEIXIN_ROBOT: ${{secrets.WEIXIN_ROBOT}}
ATTACHMENT_NAME: ./${{env.WEEKLY_PATH}}/${{env.WEEKLY_NAME}}
49 changes: 49 additions & 0 deletions 2023.02/2023.02.06-2023.02.10/template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: '第1周工作汇报'
date: '2023年02月06日-2023年02月10日'
---

<!-- 只允许使用一级标题和二级标题 -->

# 1 研究工作

本周各方向的具体研究工作完成情况如下:

## 1.1 学习Spring Cloud框架——刘雨晴

本周刘雨晴同学在之前学习的基础之上,进一步学习了Spring Cloud微服务框架,详细了解关于Config、Zuul、Bus等组件,熟悉了微服务架构在实际中所遇到各方面问题及其解决方案。

<!-- 注意该超链接应该如何使用,不需要进行手动的编号,注意附件名不能有任何的空格 -->
[刘雨晴+学习Spring Cloud框架笔记](刘雨晴+学习Spring Cloud框架笔记.docx)

# 2 工程进展

## 2.1 青岛旅游网站项目——刘雨晴、尚超

本周刘雨晴同学参加青岛旅游网站项目的开发,初步熟悉项目的需求,学习项目开发的前置知识Django框架,同时建立起项目开发的必要环境。

本周尚超同学主要工作是熟悉了青岛旅游项目,搭建项目环境。并且开会讨论了青岛旅游项目的组织时间安排与任务分工。熟悉了Web框架Django的基本结构。

# 3 项目进展

## 3.1 知识图谱技术报告文档——刘雨晴、尚超、佘嘉洛

本周刘雨晴、尚超和佘嘉洛同学编写知识图谱项目中关于知识图谱创建和知识融合的技术现状说明并提出相应的可行技术方案,完成初步版本。

# 4 其它工作

## 4.1 不确定性与质量保障论文搜集——张河、曹壮

本周张河同学与曹壮同学搜集了不确定性与质量保障的相关论文,分类为不确定性对感知分析质量的影响、感知分析不确定性处理、感知分析方法质量提升、普通感知分析方法四大类,在搜集过程中还找到一些其他类的论文,包括不确定性与测试用例、不确定性与需求满足、不确定性与自适应模型等等作为论文储备,可以作为后续的研究。

# 5 下周工作计划

## 5.1 学术方面

+ 佘嘉洛同学继续研究弹性伸缩
+ 刘雨晴同学继续研究微服务监控

## 5.2 工程方面

+ 佘嘉洛同学继续推进631项目
+ 刘雨晴同学继续推进631项目
Loading

0 comments on commit 8d0fcac

Please sign in to comment.