Skip to content

add: zen-browser-aarch64-bin (#6759) #908

add: zen-browser-aarch64-bin (#6759)

add: zen-browser-aarch64-bin (#6759) #908

Workflow file for this run

name: Check/Generate distrolist
permissions:
contents: write
pull-requests: write
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
push:
branches:
- master
jobs:
gen-distrolist:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
ref: master
- name: Generate distrolist
run: |
function get_distrolist() {
local target="${1}" location="${2}"
mapfile -t "${target}" < <(curl -fsSL "${location}"/{ubuntu.csv,debian.csv} \
| awk -F ',' -v current_date="$(date +'%Y-%m-%d')" '
BEGIN {
is_first = 1
}
$3 == "series" {
if (is_first) {
print "ubuntu:"
is_first = 0
} else {
print " devel\ndebian:"
}
next
}
NR > 1 && (($6 > current_date) || ($7 > current_date) || ($6 == "")) &&
($4 <= current_date) && $3 != "experimental" {
gsub(" LTS", "", $1);
if ($1 != "") {
print " " $3 "/" $1
} else {
print " " $3
}
}'
)
}
get_distrolist parsed_distros "https://salsa.debian.org/debian/distro-info-data/-/raw/main"
if [[ -z "${parsed_distros[*]}" ]]; then
[[ $(dpkg-query -W --showformat='${db:Status-Status}' "distro-info-data" 2> /dev/null) != "installed" ]] \
&& { apt-get update && apt-get install distro-info-data; }
get_distrolist parsed_distros "file:///usr/share/distro-info"
fi
printf "%s\n" "${parsed_distros[@]}" > distrolist
- name: Calculate diff + PR title
id: calc_pr
run: |
diff_output="$(git diff --unified=0 distrolist)"
if [[ -z "${diff_output}" ]]; then
echo "No changes to distrolist."
echo "changes_detected=false" >> $GITHUB_ENV
exit 0
else
echo "changes_detected=true" >> $GITHUB_ENV
fi
added_entries="$(echo "$diff_output" | grep '^+ ' | sed 's/^\+ //' | awk -v ORS=', ' '{print "`"$0"`"}' | sed 's/, $//')"
removed_entries="$(echo "$diff_output" | grep '^- ' | sed 's/^- //' | awk -v ORS=', ' '{print "`"$0"`"}' | sed 's/, $//')"
title="upd(distrolist): "
if [[ -n "$added_entries" && -z "$removed_entries" ]]; then
title+="add ${added_entries}"
elif [[ -z "$added_entries" && -n "$removed_entries" ]]; then
title+="rm ${removed_entries}"
elif [[ -n "$added_entries" && -n "$removed_entries" ]]; then
title+="add ${added_entries}; rm ${removed_entries}"
fi
echo "distlist_title=${title}" >> $GITHUB_ENV
echo "distlist_body=Automatically generated by CI" >> $GITHUB_ENV
dl_hash="$(echo -n "${title}" | sha256sum | cut -c1-8)"
if git ls-remote --heads origin | grep "update-distrolist-${dl_hash}"; then
echo "No changes to distrolist."
echo "changes_detected=false" >> $GITHUB_ENV
exit 0
fi
echo "dl_hash=${dl_hash}" >> $GITHUB_ENV
- name: Create PR if changes detected
if: env.changes_detected == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: distrolist
base: master
branch: update-distrolist-${{ env.dl_hash }}
title: ${{ env.distlist_title }}
body: ${{ env.distlist_body }}