mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-18 18:00:27 +08:00
* jq wasn't included in the container image, use ruby to read JSON instead * move script for generating the status report out of the workflow yml into a separate script file
30 lines
No EOL
1.1 KiB
Bash
Executable file
Vendored
30 lines
No EOL
1.1 KiB
Bash
Executable file
Vendored
#!/usr/bin/env sh
|
|
set -eu
|
|
|
|
stale_after_days="${STALE_AFTER_DAYS:-14}"
|
|
dry_run="${DRY_RUN:-true}"
|
|
|
|
bin/rails runner script/upcoming_changes_status_report -- \
|
|
--stale-after-days "${stale_after_days}" \
|
|
--pretty > /tmp/upcoming_changes_status_report.json
|
|
|
|
cat /tmp/upcoming_changes_status_report.json
|
|
|
|
eligible_count="$(
|
|
ruby -rjson -e 'records = JSON.parse(File.read(ARGV.fetch(0))); puts records.count { |record| record["eligible"] }' /tmp/upcoming_changes_status_report.json
|
|
)"
|
|
echo "eligible_count=${eligible_count}" >> "${GITHUB_OUTPUT}"
|
|
|
|
{
|
|
echo "### Upcoming change status report"
|
|
echo
|
|
echo "- Dry run: \`${dry_run}\`"
|
|
echo "- Stale after days: \`${stale_after_days}\`"
|
|
echo "- Eligible changes: \`${eligible_count}\`"
|
|
echo
|
|
ruby -rjson -e '
|
|
JSON.parse(File.read(ARGV.fetch(0))).select { |record| record["eligible"] }.each do |record|
|
|
puts "- `#{record["name"]}`: `#{record["current_status"]}` -> `#{record["next_status"]}` in `#{record["settings_path"]}`; last changed #{record["days_since_status_change"]} days ago"
|
|
end
|
|
' /tmp/upcoming_changes_status_report.json
|
|
} >> "${GITHUB_STEP_SUMMARY}" |