-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into scan_image_test
# Conflicts: # .github/workflows/scan-image.yml # .idea/workspace.xml
- Loading branch information
Showing
3 changed files
with
28 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
name: PR Comment Trigger - Scan Image | ||
name: Process PR Comment and Run Script | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
types: [created] # 仅当评论被创建时触发 | ||
|
||
jobs: | ||
scan_image: | ||
process_comment: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check if comment is "扫描镜像" | ||
if: | | ||
github.event.comment.body == '扫描镜像' | ||
run: ./.github/script/scan_image.sh $GITHUB_HEAD_REF ${{ github.event.pull_request.number }} ${{ secrets.CODEARTS_PASSWORD }} ${{ secrets.CODEARTS_SCAN_IMAGE_PIPELINE }} ${{ secrets.CODEARTS_ENDPOINT_ID }} $GIT_URL ${GITHUB_REPOSITORY%/*} ${GITHUB_REPOSITORY##*/} ${{ github.event.pull_request.head.sha }} | ||
- name: Display original comment content | ||
run: | | ||
echo "Original comment: ${{ github.event.comment.body }}" | ||
- name: Check if comment has the specified prefix and run script | ||
run: | | ||
# 获取评论内容 | ||
COMMENT_BODY="${{ github.event.comment.body }}" | ||
PREFIX="扫描镜像: " | ||
# 判断评论是否包含指定的前缀 | ||
if [[ "$COMMENT_BODY" == "$PREFIX"* ]]; then | ||
# 去掉前缀并提取后面的内容 | ||
IMAGE_URL="${COMMENT_BODY#$PREFIX}" | ||
echo "Prefix matched. Running script with parameter: $IMAGE_URL" | ||
# 执行 aaa.sh 脚本并将参数传递给脚本 | ||
./.github/script/scan_image.sh $GITHUB_HEAD_REF ${{ github.event.pull_request.number }} ${{ secrets.CODEARTS_PASSWORD }} ${{ secrets.CODEARTS_SCAN_IMAGE_PIPELINE }} ${{ secrets.CODEARTS_ENDPOINT_ID }} $GIT_URL ${GITHUB_REPOSITORY%/*} ${GITHUB_REPOSITORY##*/} "$IMAGE_URL" | ||
else | ||
echo "Comment does not match the prefix, skipping the script execution." | ||
fi |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.