commit-status.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. run: |
  15. set -euo pipefail
  16. summary_file="$GITHUB_STEP_SUMMARY"
  17. sanitize_cell() {
  18. local value="$1"
  19. value="${value//$'\r'/ }"
  20. value="${value//$'\n'/ }"
  21. value="${value//|/\\|}"
  22. printf '%s' "$value"
  23. }
  24. gitlab_latest_commit() {
  25. local branch="$1"
  26. 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'
  27. }
  28. gitlab_latest_message() {
  29. local branch="$1"
  30. 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]'
  31. }
  32. github_latest_commit() {
  33. curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors "https://api.github.com/repos/pershoot/KernelSU-Next/commits/dev-susfs" | jq -r '.sha'
  34. }
  35. github_latest_message() {
  36. curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors "https://api.github.com/repos/pershoot/KernelSU-Next/commits/dev-susfs" | jq -r '.commit.message | split("\n")[0]'
  37. }
  38. {
  39. echo "# Commit Status Report"
  40. echo ""
  41. echo "This report shows the latest upstream commit for each supported SUSFS branch plus KernelSU-Next."
  42. echo ""
  43. } >> "$summary_file"
  44. {
  45. echo "## SUSFS"
  46. echo ""
  47. echo "| Branch | Latest Commit | Latest Message |"
  48. echo "| --- | --- | --- |"
  49. } >> "$summary_file"
  50. SUSFS_BRANCHES=(
  51. "gki-android12-5.10"
  52. "gki-android13-5.10"
  53. "gki-android13-5.15"
  54. "gki-android14-5.15"
  55. "gki-android14-6.1"
  56. "gki-android15-6.6"
  57. "gki-android16-6.12"
  58. )
  59. for branch in "${SUSFS_BRANCHES[@]}"; do
  60. latest_commit="$(gitlab_latest_commit "$branch")"
  61. latest_message="$(gitlab_latest_message "$branch")"
  62. latest_message="$(sanitize_cell "$latest_message")"
  63. printf '| %s | %s | %s |\n' "$branch" "$latest_commit" "$latest_message" >> "$summary_file"
  64. done
  65. {
  66. echo ""
  67. echo "## KernelSU-Next"
  68. echo ""
  69. echo "| Branch | Latest Commit | Latest Message |"
  70. echo "| --- | --- | --- |"
  71. } >> "$summary_file"
  72. latest_kernelsu_commit="$(github_latest_commit)"
  73. latest_kernelsu_message="$(github_latest_message)"
  74. latest_kernelsu_message="$(sanitize_cell "$latest_kernelsu_message")"
  75. printf '| %s | %s | %s |\n' "dev-susfs" "$latest_kernelsu_commit" "$latest_kernelsu_message" >> "$summary_file"