Compare commits
17
Commits
yixinnb-patch-1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
469bf2e047 | ||
|
|
9307a50e34 | ||
|
|
9d96385cd6 | ||
|
|
437d81acff | ||
|
|
92246a1dca | ||
|
|
2e08390f14 | ||
|
|
9dd458a097 | ||
|
|
55c918dd91 | ||
|
|
46a710b12a | ||
|
|
4b884c8b49 | ||
|
|
8423940677 | ||
|
|
f70a993031 | ||
|
|
52e2e9884b | ||
|
|
42c4cfb3b1 | ||
|
|
442915aae5 | ||
|
|
8db78838fb | ||
|
|
85ec03d1fc |
@@ -0,0 +1,35 @@
|
|||||||
|
name: "Student Information Template"
|
||||||
|
about: "This template is for collecting student information."
|
||||||
|
title: "[join] 请勿修改此输入框内任何内容"
|
||||||
|
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="您已加入, 请[点这里继续](https://git.intcplab.cn/class)"
|
||||||
|
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 "Accept: application/json" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
$API_URL/repos/${{ github.repository }}/issues/$ISSUE_NUMBER \
|
||||||
|
-d '{"state": "closed"}'
|
||||||
Reference in New Issue
Block a user