Skip to content

Commit

Permalink
Fetch last passing daily build before rebuilding (infra) (#1165)
Browse files Browse the repository at this point in the history
* Fetch last passing daily build before rebuilding

* Actually do the selection with ==

* Document what the wall of jq queries are doing
  • Loading branch information
Hook25 authored Apr 9, 2024
1 parent 42eedd3 commit 31c1578
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/daily-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ jobs:
fetch-depth: 0
- name: Check for commits
id: commit_check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
commit_count=$(git log --since="24 hours ago" --oneline -- checkbox-ng checkbox-support providers checkbox-core-snap checkbox-snap | wc -l)
# get the last daily build that passed by
# 1. getting all workflows that are daily builds (path == ...)
# 2. removing those that did not result in success
# 3. selecting the date/time they started at (format: %Y-%m-%dT%H:%M:%sZ)
# 4. removing the Z postfix from the date to make it usable by git directly
export LAST_PASS_DAILY_BUILD=`gh api repos/canonical/checkbox/actions/runs --paginate --jq '.workflow_runs[] | select(.path == ".github/workflows/daily-builds.yml") | select(.conclusion == "success") | .run_started_at | .[:-1]' | head -1`
commit_count=$(git log --since="$LAST_PASS_DAILY_BUILD" --oneline -- checkbox-ng checkbox-support providers checkbox-core-snap checkbox-snap | wc -l)
echo "new_commit_count=$commit_count" | tee $GITHUB_OUTPUT
checkbox-core-snap-daily:
Expand Down

0 comments on commit 31c1578

Please sign in to comment.