-
Notifications
You must be signed in to change notification settings - Fork 296
fix: test & ci on 2x branch #2758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Add Label | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request_target: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| types: [opened, synchronize, reopened] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| add-label: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Check out repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Determine label based on target branch | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: determine-label | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "${{github.event_name}}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "label=2.x" >> $GITHUB_ENV | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "label=3.x" >> $GITHUB_ENV | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "label=" >> $GITHUB_ENV | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 优化标签判断逻辑的实现 当前实现存在以下问题:
建议修改为: - name: Determine label based on target branch
id: determine-label
run: |
- echo "${{github.event_name}}"
+ if [[ "${{ github.event_name }}" == "pull_request_target" && -n "${{ github.event.pull_request.base.ref }}" ]]; then
if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then
echo "label=2.x" >> "$GITHUB_ENV"
elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then
echo "label=3.x" >> "$GITHUB_ENV"
else
echo "label=" >> "$GITHUB_ENV"
fi
+ else
+ echo "label=" >> "$GITHUB_ENV"
+ fi📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint18-18: shellcheck reported issue in this script: SC2086:info:3:23: Double quote to prevent globbing and word splitting (shellcheck) 18-18: shellcheck reported issue in this script: SC2086:info:5:23: Double quote to prevent globbing and word splitting (shellcheck) 18-18: shellcheck reported issue in this script: SC2086:info:7:20: Double quote to prevent globbing and word splitting (shellcheck) |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Add label to Pull Request | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: env.label != '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions-ecosystem/action-add-labels@v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| labels: ${{ env.label }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.