Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron scheduler fix #278

Merged
merged 3 commits into from
Mar 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/workflows/cron-scheduler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ jobs:
echo "+- Skipping branch $source"
continue
fi
curl --silent --show-error -L https://api.github.com/repos/$GITHUB_REPOSITORY/commits?sha=$source | jq -r '[.[]][0]' > commit.json
date="$(jq -r '.commit.author.date' commit.json)"
echo "+- Acquiring last commit information"
curl --silent --show-error -L https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$source > commit-raw.json
head -n2 commit-raw.json | tail -n1
echo "+- Extracting last commit date"
date="$(jq -r '.commit.author.date' commit-raw.json)"
echo "+-- $date"
echo "+- Converting to timestamp"
timestamp=$(date -u -d "$date" +%s)
echo "+-- $timestamp"
echo "+- Evaluating elapsed days"
days=$(( ( $(date -u +%s) - $timestamp ) / 86400 ))
echo "+- Last commit was $days days ago"
echo "+-- Last commit was $days days ago"
if [ $days -lt 1 ]; then
echo "+- Launching cron tests on $source"
curl --silent --show-error -X POST -H "Accept: application/vnd.github.v3+json" \
Expand Down