init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
name: "Student Information Template"
|
||||
about: "This template is for collecting student information."
|
||||
title: "[join] 请勿修改此输入框内任何内容, 提交5秒后请刷新页面"
|
||||
body:
|
||||
- type: input
|
||||
id: name
|
||||
attributes:
|
||||
label: "姓名"
|
||||
description: |
|
||||
2-10 个中文字符 或 4-20 个英文字符
|
||||
placeholder: "例如:张三 或 JohnDoe"
|
||||
validations:
|
||||
required: true
|
||||
regex: ^(?:[\u4e00-\u9fa5]{2,10}|[a-zA-Z ]{4,20})$
|
||||
- type: input
|
||||
id: student_id
|
||||
attributes:
|
||||
label: "学号"
|
||||
description: |
|
||||
12位纯数字
|
||||
placeholder: "例如:202100010001"
|
||||
validations:
|
||||
required: true
|
||||
regex: ^\d{12}$
|
||||
- type: dropdown
|
||||
id: version
|
||||
attributes:
|
||||
label: 课程选择
|
||||
description: 选一个课程
|
||||
options:
|
||||
- 测试
|
||||
- 余化鹏老师的课程
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
name: Add User to Team on Issue
|
||||
on:
|
||||
issues:
|
||||
types: [ opened ]
|
||||
|
||||
jobs:
|
||||
add-to-team:
|
||||
runs-on: auto_judgement_py
|
||||
env:
|
||||
ISSUE_AUTHOR: "${{ github.event.issue.user.login }}"
|
||||
ISSUE_BODY: "${{ github.event.issue.body }}"
|
||||
API_URL: ${{ github.api_url }}
|
||||
steps:
|
||||
- name: Output GitHub Context
|
||||
id: output-context
|
||||
run: |
|
||||
# Loop through all properties in the github context
|
||||
for key in $(echo '${{ toJson(github) }}' | jq -r 'keys[]'); do
|
||||
value=$(echo '${{ toJson(github) }}' | jq -r .$key)
|
||||
echo "Property Name: $key"
|
||||
echo "Property Value: $value"
|
||||
echo "-------------------------"
|
||||
done
|
||||
|
||||
- name: Check basic
|
||||
id: check-title
|
||||
run: |
|
||||
if [[ "${{ github.event.issue.title }}" == "[join]"* ]]; then
|
||||
echo "::set-output name=valid_title::true"
|
||||
else
|
||||
echo "::set-output name=valid_title::false"
|
||||
fi
|
||||
|
||||
- name: Add user to team
|
||||
if: steps.check-title.outputs.valid_title == 'true'
|
||||
run: |
|
||||
# 设置变量
|
||||
TOKEN="${{ secrets.YX_TOKEN }}" # 替换为你的 Gitea Access Token
|
||||
TEAM_ID="9" # 替换为目标团队的 ID org:class:member
|
||||
|
||||
# 调用 Gitea API 将用户加入团队
|
||||
curl -X PUT \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
"$API_URL/teams/$TEAM_ID/members/$ISSUE_AUTHOR"
|
||||
|
||||
echo "请求成功 ( $ISSUE_AUTHOR"
|
||||
|
||||
- name: 保存学生信息
|
||||
working-directory: /app
|
||||
run: |
|
||||
python3 join_class.py
|
||||
|
||||
- name: Comment on issue
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用默认的 GITHUB_TOKEN
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
COMMENT_BODY="个人信息已与$ISSUE_AUTHOR绑定, 更换用户名后请重新发起工单. \n## 已成功加入课程, 请[点这里跳转到课程](https://git.intcplab.cn/experiment_python)"
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Accept: application/json" \
|
||||
-H 'Content-Type: application/json' \
|
||||
$API_URL/repos/${{ github.repository }}/issues/$ISSUE_NUMBER/comments \
|
||||
-d "{\"body\": \"$COMMENT_BODY\"}"
|
||||
|
||||
- name: Close issue
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
curl -s -X PATCH \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Accept: application/json" \
|
||||
$API_URL/repos/${{ github.repository }}/issues/$ISSUE_NUMBER \
|
||||
-d '{"state": "closed"}'
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
@@ -0,0 +1,44 @@
|
||||
# 如何加入课程
|
||||
|
||||
步骤: **在本仓库发起一个填写了你的个人信息的工单**
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user