2 Commits
Author SHA1 Message Date
yixinnb 366db709d9 更新 .gitea/workflows/demo.yaml
Process Python Script on PR / process-python (pull_request) Failing after 33s
2025-02-28 21:56:15 +08:00
yixinnb bcb62d2fa9 更新 readme.md
Process Python Script on PR / process-python (pull_request) Failing after 2s
2025-02-28 17:31:05 +08:00
4 changed files with 10 additions and 117 deletions
-35
View File
@@ -1,35 +0,0 @@
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
-77
View File
@@ -1,77 +0,0 @@
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"}'
+9 -4
View File
@@ -11,11 +11,16 @@ jobs:
process-python: process-python:
runs-on: auto_judgement_py runs-on: auto_judgement_py
steps: steps:
- name: test - name: Output GitHub Context
id: output-context
run: | run: |
env > /app/env.txt # Loop through all properties in the github context
echo "${{secrets.ACCESS_TOKEN}}" for key in $(echo '${{ toJson(github) }}' | jq -r 'keys[]'); do
cp -r /root/.cache/act /app/cache/ value=$(echo '${{ toJson(github) }}' | jq -r .$key)
echo "Property Name: $key"
echo "Property Value: $value"
echo "-------------------------"
done
- name: Checkout PR code - name: Checkout PR code
uses: actions/checkout@v4 uses: actions/checkout@v4
+1 -1
View File
@@ -1 +1 @@
5 tttt