Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a9a1d2c
update ci and status sh
Proton02 Sep 11, 2025
8c2183e
Update get-CI-result.sh to fix curl command
Proton02 Sep 11, 2025
fff24b3
Update get-CI-result.sh
Proton02 Sep 11, 2025
f3b9fed
Update get-CI-result.sh to correctly fetch CI status
Proton02 Sep 11, 2025
af007f4
Update get-CI-result.sh to correctly fetch CI status
Proton02 Sep 11, 2025
95ed167
test
Proton02 Sep 11, 2025
f00fb86
test
Proton02 Sep 11, 2025
cc11e80
fail return -1
Proton02 Sep 11, 2025
120830a
fix a bug in CI status check
Proton02 Sep 11, 2025
c319a48
test
Proton02 Sep 11, 2025
9d33316
test
Proton02 Sep 11, 2025
2f74573
test
Proton02 Sep 11, 2025
40c6ded
test
Proton02 Sep 11, 2025
663f0e1
test
Proton02 Sep 11, 2025
e73a807
test
Proton02 Sep 11, 2025
7b7e6bf
test
Proton02 Sep 11, 2025
8d71336
test
Proton02 Sep 11, 2025
cd79a7c
test
Proton02 Sep 11, 2025
719ee06
Merge branch 'main' of https://github.com/wht21/test-public into luox…
Proton02 Sep 12, 2025
80a90ff
support for merge tasks, update trigger and get scripts
Proton02 Sep 12, 2025
d4e9a22
test
Proton02 Sep 12, 2025
42ca235
test
Proton02 Sep 12, 2025
8fa9e3e
test
Proton02 Sep 12, 2025
c2824f4
test
Proton02 Sep 12, 2025
2291362
test
Proton02 Sep 12, 2025
5056708
test
Proton02 Sep 12, 2025
d61cc2c
tewq
Proton02 Sep 12, 2025
1c2da4a
test
Proton02 Sep 12, 2025
07077be
test
Proton02 Sep 12, 2025
e64cad9
test
Proton02 Sep 12, 2025
c506173
test
Proton02 Sep 12, 2025
8a1e63b
test
Proton02 Sep 12, 2025
e41f93e
test
Proton02 Sep 12, 2025
bc88de8
test
Proton02 Sep 12, 2025
e464e66
test
Proton02 Sep 12, 2025
08586a0
test
Proton02 Sep 12, 2025
d943af8
test
Proton02 Sep 12, 2025
a7c9cf4
test
Proton02 Sep 12, 2025
55be08c
test
Proton02 Sep 12, 2025
5bdd262
test
Proton02 Sep 12, 2025
82da8ce
finish 1 2, test 3
Proton02 Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Trigger on PR Merge
name: Trigger Aone Merge on PR Merge

on:
pull_request:
Expand All @@ -8,12 +8,25 @@ on:
jobs:
trigger-on-merge:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true

steps:
- name: Check if PR was merged
- name: Checkout repository
uses: actions/checkout@v3

- name: Make scripts executable
run: chmod +x trigger-merge.sh get-merge-result.sh

- name: Trigger Aone Merge Task
id: trigger
run: |
echo "Triggering Aone merge for commit ${{ github.event.pull_request.head.sha }}"
./trigger-merge.sh "${{ github.event.pull_request.head.sha }}" "${{ secrets.CI_SECRET }}"
env:
AONE_PROJECT_ID: "3512232"
GITHUB_REPOSITORY: ${{ github.repository }}

- name: Get Merge Result
run: |
if [ "${{ github.event.pull_request.merged }}" = "true" ]; then
echo "PR was merged"
# 在这里添加你想要执行的命令
else
echo "PR was not merged"
fi
echo "Polling for merge result of commit ${{ github.event.pull_request.head.sha }}"
./get-merge-result.sh "${{ github.event.pull_request.head.sha }}" "${{ secrets.CI_SECRET }}"
6 changes: 3 additions & 3 deletions .github/workflows/simple-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
run: chmod +x trigger-CI.sh get-CI-result.sh
- name: trigger a CI
run: |
curl -v -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.CI_SECRET }}" -d '{"commitId":"${{ github.sha }}","repositoryUrl":"https://github.com/alibaba/rtp-llm.git","taskId":"9180024","type":"CREATE-TASK"}' "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run"
./trigger-CI.sh "${{ github.sha }}" "${{ secrets.CI_SECRET }}"

# Runs get CI result
- name: get a CI result
- name: Get CI result
run: |
./get-CI-result.sh ${{ steps.script-output.outputs.result }}
./get-CI-result.sh "${{ github.sha }}" "${{ secrets.CI_SECRET }}"
1 change: 1 addition & 0 deletions public-dir/test
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test
fasdfkjbsdsafdsf3ddfsaddsafdsa11
3 changes: 2 additions & 1 deletion public-dir/testpr
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fwelflmvc
fwelflmvc213q
dsa1123s11
39 changes: 38 additions & 1 deletion script/get-CI-result.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
#!/bin/bash

echo "hello world"
# 检查参数
if [ $# -ne 2 ]; then
echo "Usage: $0 <COMMIT_ID> <SECURITY>"
exit 1
fi

COMMIT_ID=$1
SECURITY=$2


while true; do
echo "Querying CI status for commitId: ${COMMIT_ID} ..."

response=$(curl -s -H "Content-Type: application/json" \
-H "Authorization: Basic ${SECURITY}" \
-d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run")
echo "Response: $response"

status=$(echo "$response" | jq -r '.status | if test("^\\{") then fromjson.status else . end')

if [[ "$status" == "DONE" || "$status" == "FAILED" || "$status" == "UNKNOWN" || "$status" == "CANCELED" ]]; then
echo "Current status: $status"
if [[ "$status" == "DONE" ]]; then
echo "CI completed successfully"
elif [[ "$status" == "FAILED" ]]; then
echo "CI failed"
elif [[ "$status" == "UNKNOWN" ]]; then
echo "CI status is unknown"
elif [[ "$status" == "CANCELED" ]]; then
echo "CI was canceled"
else
echo "Unexpected status: $status"
fi
break
fi

sleep 5
done
29 changes: 29 additions & 0 deletions script/get-merge-result.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# 检查参数
if [ $# -ne 2 ]; then
echo "Usage: $0 <COMMIT_ID> <SECURITY>"
exit 1
fi

COMMIT_ID=$1
SECURITY=$2


while true; do
echo "Querying merge status for commitId: ${COMMIT_ID} ..."

response=$(curl -s -H "Content-Type: application/json" \
-H "Authorization: Basic ${SECURITY}" \
-d "{\"type\": \"RETRIEVE-MERGE-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run")
status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"')

echo "Current status: $status"

if [ "$status" != "PENDING" ]; then
echo "Merge process completed with status: $status"
break
fi

sleep 5
done
19 changes: 16 additions & 3 deletions script/trigger-CI.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#!/bin/bash

# Check if two arguments are provided
Expand All @@ -7,9 +6,13 @@ if [ $# -ne 2 ]; then
exit 1
fi

# Read the two parameters
# Read commitId, repositoryUrl, and security from parameters or environment variables
COMMIT_ID=$1
SECURITY=$2
REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git"
PROJECT_ID="3512232"
BRANCH_REF="main"
BRANCH_NAME="open_merge_${COMMIT_ID}"

# Get current timestamp
timestamp=$(date +%s)
Expand All @@ -26,4 +29,14 @@ echo "MD5 hash of '${COMMIT_ID}' and '${SECURITY}' combined with timestamp is: $
# Return the MD5 hash as the script's exit code
echo "${SECURITY}"

curl -v -H "Content-Type: application/json" -H "Authorization: Basic '${SECURITY}'" -d '{"message": "Hello"}' "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run"
# 发送 CREATE-TASK 请求
curl -v -H "Content-Type: application/json" \
-H "Authorization: Basic ${SECURITY}" \
-d "{
\"type\": \"CREATE-TASK\",
\"commitId\": \"${COMMIT_ID}\",
\"repositoryUrl\": \"${REPO_URL}\",
\"aone\": { \"projectId\": \"${PROJECT_ID}\" },
\"newBranch\": { \"name\": \"${BRANCH_NAME}\", \"ref\": \"${BRANCH_REF}\" }
}" \
"https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run"
59 changes: 59 additions & 0 deletions script/trigger-merge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

if [ $# -ne 2 ]; then
echo "Usage: $0 <COMMIT_ID> <SECURITY>"
exit 1
fi

COMMIT_ID=$1
SECURITY=$2
REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git"
AONE_PROJECT_ID="${AONE_PROJECT_ID}"
AUTHOR_EMAIL="yanan.yn@alibaba-inc.com"
AUTHOR_NAME="隆宇"
MERGE_MESSAGE="foo"
MERGE_TYPE="SQUASH"
SOURCE_BRANCH="open_merge_${COMMIT_ID}"
TARGET_BRANCH="main"

# Get current timestamp
timestamp=$(date +%s)

# Concatenate the parameters with timestamp
combined="${COMMIT_ID}${SECURITY}${timestamp}"

# Calculate the MD5 hash
base64_hash=$(echo -n "${combined}" | base64)

# Output the MD5 hash
echo "MD5 hash of '${COMMIT_ID}' and '${SECURITY}' combined with timestamp is: ${md5_hash}"

# Return the MD5 hash as the script's exit code
echo "${SECURITY}"


JSON_BODY=$(cat <<EOF
{
\"type\": \"MERGE-TASK\",
\"repositoryUrl\": \"${REPO_URL}\",
\"commitId\": \"${COMMIT_ID}\",
\"aone\": {
\"projectId\": \"${AONE_PROJECT_ID}\"
},
\"authorEmail\": \"${AUTHOR_EMAIL}\",
\"authorName\": \"${AUTHOR_NAME}\",
\"mergeMessage\": \"${MERGE_MESSAGE}\",
\"mergeType\": \"${MERGE_TYPE}\",
\"sourceBranch\": \"${SRC_BRANCH}\",
\"targetBranch\": \"${DEST_BRANCH}\"
}
EOF
)

echo "Sending MERGE-TASK for commitId: ${COMMIT_ID}"

# 调用 HTTP 函数发送消息
curl -v -H "Content-Type: application/json" \
-H "Authorization: Basic ${SECURITY}" \
-d "${JSON_BODY}" \
"https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run"
Loading