Skip to content

Conversation

@hudeng-go
Copy link
Contributor

Replaced action to get email from GitHub username with a script that reads email from debian/changelog.

原因为github 获取email的api接口目前不可用。

Replaced action to get email from GitHub username with a script that reads email from debian/changelog. 

原因为github 获取email的api接口目前不可用。
@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hudeng-go

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

我来对这个GitHub Actions工作流文件的变更进行审查:

  1. 功能变更分析:

    • 原代码使用第三方action evvanErb/get-github-email-by-username-action@v2.0 来获取PR提交者的邮箱
    • 新代码改为从 debian/changelog 文件中提取邮箱信息
  2. 代码质量改进建议:

    • 建议添加错误处理机制,以防 debian/changelog 文件不存在或格式不正确:
      run: |
        if [ -f "debian/changelog" ]; then
          email=$(grep -m1 '^ -- ' debian/changelog | sed 's/.*<\([^>]*\)>.*/\1/')
          if [ -n "$email" ]; then
            echo "email=$email" >> $GITHUB_OUTPUT
          else
            echo "Failed to extract email from changelog"
            exit 1
          fi
        else
          echo "debian/changelog not found"
          exit 1
        fi
  3. 安全性考虑:

    • 新方案移除了对第三方action的依赖,减少了潜在的安全风险
    • 但需要确保 debian/changelog 文件的访问权限是受控的
  4. 性能考虑:

    • 新方案减少了对外部action的调用,可能会提高执行速度
    • grep和sed命令都是高效的文本处理工具,性能影响很小
  5. 可靠性考虑:

    • 原方案直接从GitHub获取邮箱信息,更可靠
    • 新方案依赖 debian/changelog 文件的格式,如果格式不统一可能导致失败
    • 建议添加格式验证机制
  6. 维护性建议:

    • 建议添加注释说明邮箱提取的格式要求
    • 可以考虑将提取逻辑封装成一个可重用的action或shell脚本
  7. 替代方案建议:

    • 可以考虑使用GitHub API直接获取用户邮箱信息:
      run: |
        email=$(curl -H "Authorization: token ${{ steps.get-token.outputs.app_token }}" \
          https://api.github.com/users/${{ github.event.pull_request.user.login }} | \
          jq -r '.email')
        echo "email=$email" >> $GITHUB_OUTPUT

总的来说,这个变更减少了对外部依赖,但增加了对本地文件格式的依赖。建议添加适当的错误处理和验证机制来提高可靠性。

@myml myml merged commit 65d2c49 into linuxdeepin:master Oct 31, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants