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