Some checks failed
Build hyprland-git / Build and push image (push) Failing after 1m5s
36 lines
1.9 KiB
Bash
Executable File
36 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
set -euxo pipefail
|
|
|
|
curl_opts=(--connect-timeout 10 --retry 7 --retry-connrefused -Ss -X POST)
|
|
|
|
oldHyprlandCommit="$(sed -n 's/.*hyprland_commit \(.*\)/\1/p' hyprland-git.spec)"
|
|
newHyprlandCommit="$(curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/hyprwm/Hyprland/commits/main")"
|
|
|
|
oldCommitsCount="$(sed -n 's/.*commits_count \(.*\)/\1/p' hyprland-git.spec)"
|
|
newCommitsCount="$(curl -I -k \
|
|
"https://api.github.com/repos/hyprwm/Hyprland/commits?per_page=1&sha=$newHyprlandCommit" | \
|
|
sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p')"
|
|
|
|
oldCommitDate="$(sed -n 's/.*commit_date \(.*\)/\1/p' hyprland-git.spec)"
|
|
newCommitDate="$(env TZ=Etc/GMT+12 date -d "$(curl -s "https://api.github.com/repos/hyprwm/Hyprland/commits?per_page=1&ref=$newHyprlandCommit" | \
|
|
jq -r '.[].commit.author.date')" +"%a %b %d %T %Y")"
|
|
|
|
oldProtocolsCommit="$(sed -n 's/.*protocols_commit \(.*\)/\1/p' hyprland-git.spec)"
|
|
newProtocolsCommit="$(curl -L \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
"https://api.github.com/repos/hyprwm/Hyprland/contents/subprojects/hyprland-protocols?ref=$newHyprlandCommit" | jq -r '.sha')"
|
|
|
|
oldUdis86Commit="$(sed -n 's/.*udis86_commit \(.*\)/\1/p' hyprland-git.spec)"
|
|
newUdis86Commit="$(curl -L \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
"https://api.github.com/repos/hyprwm/Hyprland/contents/subprojects/udis86?ref=$newHyprlandCommit" | jq -r '.sha')"
|
|
|
|
sed -e "s/$oldHyprlandCommit/$newHyprlandCommit/" \
|
|
-e "/%global commits_count/s/$oldCommitsCount/$newCommitsCount/" \
|
|
-e "s/$oldCommitDate/$newCommitDate/" \
|
|
-e "s/$oldProtocolsCommit/$newProtocolsCommit/" \
|
|
-e "s/$oldUdis86Commit/$newUdis86Commit/" \
|
|
-i hyprland-git.spec
|