commit-status.yml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. name: Commit Status Report
  2. on:
  3. workflow_dispatch:
  4. jobs:
  5. report:
  6. runs-on: ubuntu-latest
  7. permissions:
  8. contents: read
  9. steps:
  10. - name: Checkout repository
  11. uses: actions/checkout@v7
  12. - name: Build commit summary
  13. shell: bash
  14. env:
  15. GH_TOKEN: ${{ github.token }}
  16. run: |
  17. set -euo pipefail
  18. summary_file="$GITHUB_STEP_SUMMARY"
  19. sanitize_cell() {
  20. local value="$1"
  21. value="${value//$'\r'/ }"
  22. value="${value//$'\n'/ }"
  23. value="${value//|/\\|}"
  24. printf '%s' "$value"
  25. }
  26. gitlab_latest_commit() {
  27. local branch="$1"
  28. curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors "https://gitlab.com/api/v4/projects/simonpunk%2Fsusfs4ksu/repository/commits?ref_name=${branch}&per_page=1" | jq -r '.[0].id'
  29. }
  30. gitlab_latest_message() {
  31. local branch="$1"
  32. curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors "https://gitlab.com/api/v4/projects/simonpunk%2Fsusfs4ksu/repository/commits?ref_name=${branch}&per_page=1" | jq -r '.[0].message | split("\n")[0]'
  33. }
  34. github_latest_commit() {
  35. curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors -H "Authorization: Bearer ***" "https://api.github.com/repos/pershoot/KernelSU-Next/commits/dev-susfs" | jq -r '.sha'
  36. }
  37. github_latest_message() {
  38. curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors -H "Authorization: Bearer ***" "https://api.github.com/repos/pershoot/KernelSU-Next/commits/dev-susfs" | jq -r '.commit.message | split("\n")[0]'
  39. }
  40. {
  41. echo "# Commit Status Report"
  42. echo ""
  43. echo "This report shows the latest upstream commit for each supported SUSFS branch plus KernelSU-Next."
  44. echo ""
  45. } >> "$summary_file"
  46. {
  47. echo "## SUSFS"
  48. echo ""
  49. echo "| Branch | Latest Commit | Latest Message |"
  50. echo "| --- | --- | --- |"
  51. } >> "$summary_file"
  52. SUSFS_BRANCHES=(
  53. "gki-android12-5.10"
  54. "gki-android13-5.10"
  55. "gki-android13-5.15"
  56. "gki-android14-5.15"
  57. "gki-android14-6.1"
  58. "gki-android15-6.6"
  59. "gki-android16-6.12"
  60. )
  61. for branch in "${SUSFS_BRANCHES[@]}"; do
  62. latest_commit="$(gitlab_latest_commit "$branch")"
  63. latest_message="$(gitlab_latest_message "$branch")"
  64. latest_message="$(sanitize_cell "$latest_message")"
  65. printf '| %s | %s | %s |\n' "$branch" "$latest_commit" "$latest_message" >> "$summary_file"
  66. done
  67. {
  68. echo ""
  69. echo "## KernelSU-Next"
  70. echo ""
  71. echo "| Branch | Latest Commit | Latest Message |"
  72. echo "| --- | --- | --- |"
  73. } >> "$summary_file"
  74. latest_kernelsu_commit="$(github_latest_commit)"
  75. latest_kernelsu_message="$(github_latest_message)"
  76. latest_kernelsu_message="$(sanitize_cell "$latest_kernelsu_message")"
  77. printf '| %s | %s | %s |\n' "dev-susfs" "$latest_kernelsu_commit" "$latest_kernelsu_message" >> "$summary_file"