Workflows become truly powerful when they act on real, up-to-the-minute data — not just canned prompts.
You'll extend your daily-status workflow to fetch open issues from your repository using the GitHub CLI, then inject that data into your AI prompt. By the end, your summary will include an overview of outstanding issues alongside the commit activity.
- You have installed the
gh-awextension in Install thegh-awCLI Extension. - You have a working daily-status workflow from Build: Daily Repo Status Workflow.
- You're comfortable running and iterating on workflows from Test and Improve Your Workflow.
gh-aw workflows run inside GitHub Actions, so your workflow can fetch live repository data before the AI writes anything. In this step, you will use shell steps to collect data and a later prompt section to turn that data into a summary.
Think of it as a handoff. First, the workflow gathers facts in a predictable way. Then, the prompt reads those saved results and asks the AI to explain what matters.
Tip
If step outputs, here-document syntax, or the scripted versus agentic split are new to you, skim Side Quest: Passing Data Between Steps with $GITHUB_OUTPUT and Side Quest: Deterministic vs Agentic Data Ops.
Open .github/workflows/daily-status.md and add two steps to the steps: block in the frontmatter.
First, fetch the recent commit log:
- name: Fetch recent commits
id: recent # step ID — referenced as steps.recent.outputs.…
run: |
# Lists commits from the last 24 hours (max 10), format: "<hash> <subject>"
COMMIT_LOG=$(git log --oneline --since="24 hours ago" --format="%h %s" | head -10)
# <<EOF writes a multi-line value to $GITHUB_OUTPUT
echo "commit_log<<EOF" >> $GITHUB_OUTPUT
echo "$COMMIT_LOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT🤔 Pause and predict: What will the commit_log output contain if no commits were made in the last 24 hours? Form your prediction now and verify it after you trigger a run.
Next, add a step to fetch open issues:
- name: Fetch open issues
id: issues # step ID — referenced as steps.issues.outputs.…
run: |
# Fetch the 10 most recent open issues, formatted as "#42 Fix the bug"
ISSUE_LIST=$(gh issue list --state open --limit 10 \
--json number,title \
--jq '.[] | "#\(.number) \(.title)"')
# Count all open issues
ISSUE_COUNT=$(gh issue list --state open --json number --jq 'length')
echo "open_issues<<EOF" >> $GITHUB_OUTPUT
echo "$ISSUE_LIST" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "open_issues_count=$ISSUE_COUNT" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # provided automatically — no setup needed✏️ Try it: Run gh issue list --state open --json number --jq 'length' in your terminal and note the count. After you trigger a workflow run, check whether the workflow reports the same total.
🤔 Pause and predict: What will the AI receive if the issue list is empty? Will the prompt still produce a useful output?
The AI prompt lives in the Markdown body after the frontmatter. Update that section so it uses the step outputs:
---
# … your existing frontmatter with the two new steps …
---
Summarise recent activity in this repository.
Recent commits (last 24 hours):
${{ steps.recent.outputs.commit_log }}
Open issues (${{ steps.issues.outputs.open_issues_count }} total):
${{ steps.issues.outputs.open_issues }}
Write a concise, friendly update — two short paragraphs.
Highlight anything that looks urgent in the issue list.GitHub resolves the step-output expressions before the AI sees the prompt, so the model receives plain text instead of workflow syntax.
🤔 Pause and predict: If the commit_log output is empty, does the prompt still make sense to the AI? What one-line change would make the instruction more robust?
✏️ Try it: Change "two short paragraphs" to "one bullet list per topic" and re-run. Notice how the output format shifts.
gh aw compileFix any errors, then push and trigger a manual run:
git add .github/workflows/daily-status.md
git commit -m "feat: inject open issues into daily summary prompt"
git pushOpen the Actions tab and verify the new steps appear and the AI summary mentions both commits and issues.
Tip
If your repository has no open issues, the AI will say so — that's expected. Create a test issue to see the integration in action.
Once you're comfortable with this pattern, the same technique works for:
| Data | Command |
|---|---|
| Open pull requests | gh pr list --state open |
| Recent releases | gh release list --limit 5 |
| Failed workflow runs | gh run list --status failure --limit 5 |
| Repository stats | gh api repos/:owner/:repo |
- Your workflow has a recent-commits step with
id: recent - Your workflow has an open-issues step with
id: issues - Your AI prompt uses both saved outputs
-
gh aw compilereports no errors - A manual run completes and the summary mentions both commits and open issues
- You can explain how the workflow passes fetched data into the prompt
- You can describe what happens if the recent commit output is empty and how your prompt handles it
Next: Give Your Agent More Tools with MCP
Tip
Security reading: token exfiltration and long-lived credential risks
Now that your workflow reads live repository data, you're exposing a surface that attackers can try to exploit:
- Token exfiltration: learn how crafted issue or PR content can attempt to leak your
GITHUB_TOKEN— and how gh-aw stops it — in Side Quest: Token and Secret Exfiltration in Agentic Workflows. - Long-lived credential risks: if your workflow ever needs a personal access token (PAT), read Side Quest: Long-Lived Credential Risks in Agentic Workflows to understand why PATs create a larger attack surface and how
permissions:minimization andnetwork.allowedcontain the blast radius.