添加 .gitea/workflows/auto_join.yaml
Process Python Script on PR / process-python (push) Failing after 2s
Process Python Script on PR / process-python (push) Failing after 2s
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
name: Add User to Team on Issue
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
add-to-team:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check if issue title starts with [join]
|
||||||
|
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: |
|
||||||
|
# 设置变量
|
||||||
|
GITEA_URL="http://10.2.2.195" # 替换为你的 Gitea 地址
|
||||||
|
TOKEN="${{ secrets.YX_TOKEN }}" # 替换为你的 Gitea Access Token
|
||||||
|
TEAM_ID="9" # 替换为目标团队的 ID org:class-member
|
||||||
|
ISSUE_USER="${{ github.event.issue.user.login }}"
|
||||||
|
|
||||||
|
# 调用 Gitea API 将用户加入团队
|
||||||
|
curl -X PUT \
|
||||||
|
-H "Authorization: token $TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"$GITEA_URL/api/v1/teams/$TEAM_ID/members/$ISSUE_USER"
|
||||||
|
|
||||||
|
echo "$ISSUE_USER 已加入课程"
|
||||||
Reference in New Issue
Block a user