Skip to content

Commit 21f96dd

Browse files
committed
1
1 parent e9712b5 commit 21f96dd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/fetch_and_log.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
- name: Fetch Unprocessed Workflow Runs
2525
id: fetch-unprocessed-run-ids
2626
run: |
27-
#WORKFLOW_IDS=$(gh run list --repo $GITHUB_REPOSITORY --limit 100 --json databaseId,createdAt,displayTitle --jq "[.[] | select(.databaseId > $LAST_PROCESSED_RUN_ID and .displayTitle != \"Fetch and Log Workflow Runs\") | .databaseId] | @json")
27+
# TODO: We need to address an important issue where workflow runs that are currently in progress may be included.
28+
# These should be excluded from processing, and we should revisit them in the next run once they have finished.
2829
WORKFLOW_IDS=$(gh run list --repo $GITHUB_REPOSITORY --limit 100 --json databaseId,createdAt,displayTitle --jq "[.[] | select(.databaseId > $LAST_PROCESSED_RUN_ID and .displayTitle != \"Fetch and Log Workflow Runs\")] | sort_by(.databaseId) | [.[].databaseId] | @json")
2930
echo "Workflow runs to process: $WORKFLOW_IDS"
3031
echo "workflow_ids=$WORKFLOW_IDS" >> $GITHUB_OUTPUT
@@ -49,4 +50,13 @@ jobs:
4950
run: |
5051
gh variable set LAST_PROCESSED_RUN_ID --repo $GITHUB_REPOSITORY --body "${{ matrix.run_id }}"
5152
env:
52-
GH_TOKEN: ${{ secrets.GH_PAT }}
53+
GH_TOKEN: ${{ secrets.GH_PAT }}
54+
55+
# Add a fallback job that runs when there are no workflow Run's to process
56+
process-logs-empty:
57+
needs: fetch-workflows
58+
runs-on: ubuntu-latest
59+
if: ${{ needs.fetch-workflows.outputs.workflow_ids == '[]' || needs.fetch-workflows.outputs.workflow_ids == '' }}
60+
steps:
61+
- name: No workflows to process
62+
run: echo "No new workflow runs to process"

0 commit comments

Comments
 (0)