Optimized Flatpak workflow

This commit is contained in:
Thorsten Sommer 2026-07-16 13:39:57 +02:00
parent 1ce4b4f4fb
commit 40833a556f
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -500,7 +500,7 @@ jobs:
FLATPAK_COMMIT: ${{ needs.sync_flatpak_repo.outputs.flatpak_commit }} FLATPAK_COMMIT: ${{ needs.sync_flatpak_repo.outputs.flatpak_commit }}
steps: steps:
- name: Wait for Flatpak main build - name: Dispatch and wait for Flatpak build
id: flatpak_run id: flatpak_run
env: env:
GH_TOKEN: ${{ secrets.FLATPAK_WORKFLOW_TOKEN }} GH_TOKEN: ${{ secrets.FLATPAK_WORKFLOW_TOKEN }}
@ -508,7 +508,7 @@ jobs:
set -euo pipefail set -euo pipefail
find_run_id() { find_run_id() {
local created_after="${1:-}" local created_after="$1"
local runs local runs
runs=$(gh run list \ runs=$(gh run list \
@ -519,16 +519,10 @@ jobs:
--limit 20 \ --limit 20 \
--json databaseId,event,headSha,createdAt) --json databaseId,event,headSha,createdAt)
if [ -n "$created_after" ]; then
echo "$runs" | jq -r \ echo "$runs" | jq -r \
--arg commit "$FLATPAK_COMMIT" \ --arg commit "$FLATPAK_COMMIT" \
--arg created_after "$created_after" \ --arg created_after "$created_after" \
'[.[] | select(.headSha == $commit and .event == "workflow_dispatch" and .createdAt >= $created_after)][0].databaseId // empty' '[.[] | select(.headSha == $commit and .event == "workflow_dispatch" and .createdAt >= $created_after)][0].databaseId // empty'
else
echo "$runs" | jq -r \
--arg commit "$FLATPAK_COMMIT" \
'[.[] | select(.headSha == $commit and (.event == "push" or .event == "workflow_dispatch"))][0].databaseId // empty'
fi
} }
validate_required_artifacts() { validate_required_artifacts() {
@ -601,21 +595,9 @@ jobs:
return 2 return 2
} }
run_id=""
for attempt in {1..15}; do
run_id=$(find_run_id)
if [ -n "$run_id" ]; then
break
fi
echo "Waiting for Flatpak workflow on commit ${FLATPAK_COMMIT}..."
sleep 20
done
if [ -z "$run_id" ]; then
current_main=$(gh api "repos/${FLATPAK_REPOSITORY}/commits/main" --jq .sha) current_main=$(gh api "repos/${FLATPAK_REPOSITORY}/commits/main" --jq .sha)
if [ "$current_main" != "$FLATPAK_COMMIT" ]; then if [ "$current_main" != "$FLATPAK_COMMIT" ]; then
echo "No Flatpak run exists for ${FLATPAK_COMMIT}, and Flatpak main has advanced to ${current_main}." echo "Flatpak main advanced from ${FLATPAK_COMMIT} to ${current_main} before the build could be dispatched."
exit 1 exit 1
fi fi
@ -625,6 +607,7 @@ jobs:
--ref main \ --ref main \
-f "artifact_retention_days=${RETENTION_INTERMEDIATE_ASSETS}" -f "artifact_retention_days=${RETENTION_INTERMEDIATE_ASSETS}"
run_id=""
for attempt in {1..15}; do for attempt in {1..15}; do
run_id=$(find_run_id "$dispatch_started_at") run_id=$(find_run_id "$dispatch_started_at")
if [ -n "$run_id" ]; then if [ -n "$run_id" ]; then
@ -634,7 +617,6 @@ jobs:
echo "Waiting for the dispatched Flatpak workflow on commit ${FLATPAK_COMMIT}..." echo "Waiting for the dispatched Flatpak workflow on commit ${FLATPAK_COMMIT}..."
sleep 20 sleep 20
done done
fi
if [ -z "$run_id" ]; then if [ -z "$run_id" ]; then
echo "Timed out waiting for a Flatpak workflow to start on commit ${FLATPAK_COMMIT}." echo "Timed out waiting for a Flatpak workflow to start on commit ${FLATPAK_COMMIT}."