|
| 1 | +<!-- page-journey: all --> |
| 2 | +<!-- page-adventure: core --> |
| 3 | +# Test and Improve Your Workflow |
| 4 | + |
| 5 | +_The fastest path to a better workflow is a tight loop: change one thing, compile, test, and compare the result._ |
| 6 | + |
| 7 | +## 🎯 What You'll Do |
| 8 | + |
| 9 | +You'll make one small improvement to your workflow, recompile it before testing, trigger a fresh run, and compare the new output against the previous one. |
| 10 | + |
| 11 | +By the end of this step, you'll have a repeatable iteration loop you can use any time the workflow output is vague, incorrect, or missing something important. |
| 12 | + |
| 13 | +## 📋 Before You Start |
| 14 | + |
| 15 | +- You have a working workflow draft from [Refine Your Workflow with Agentic Editing](09-agentic-editing.md) or an equivalent earlier build step in your chosen path. |
| 16 | +- You have at least one completed workflow run to inspect. |
| 17 | +- You can edit the workflow in a terminal, Codespace, or Copilot agent session. |
| 18 | + |
| 19 | +## Start With One Concrete Observation |
| 20 | + |
| 21 | +Open the latest run in the **Actions** tab and look for one thing you want to improve. |
| 22 | + |
| 23 | +Good examples: |
| 24 | + |
| 25 | +- The summary is too generic. |
| 26 | +- An important detail is missing. |
| 27 | +- The tone feels too stiff. |
| 28 | +- The formatting is inconsistent. |
| 29 | + |
| 30 | +Pick only one problem for this round. Small, isolated changes make it much easier to tell what actually improved the result. |
| 31 | + |
| 32 | +## Make One Targeted Change |
| 33 | + |
| 34 | +Open your workflow source file, such as `.github/workflows/daily-status.md`, and change only one instruction in the Markdown body or the YAML frontmatter at the top of the file. |
| 35 | + |
| 36 | +Examples of focused changes: |
| 37 | + |
| 38 | +- ask for a shorter or more structured output format |
| 39 | +- name one missing field the agent should include |
| 40 | +- add a fallback instruction for empty results |
| 41 | +- tighten one permission or safe-output rule |
| 42 | + |
| 43 | +If you are using a Copilot agent to edit the file, tell it to make the change, review the diff, and then run `gh aw compile` before testing. |
| 44 | + |
| 45 | +> [!IMPORTANT] |
| 46 | +> Compile after every workflow edit before you test it. GitHub Actions runs the compiled `.lock.yml` file, not the source `.md` file, so skipping `gh aw compile` means you are testing stale workflow logic. |
| 47 | +
|
| 48 | +## Compile Before You Test |
| 49 | + |
| 50 | +From your repository root, run: |
| 51 | + |
| 52 | +```bash |
| 53 | +gh aw compile |
| 54 | +``` |
| 55 | + |
| 56 | +This updates the compiled lock file that GitHub Actions actually executes. |
| 57 | + |
| 58 | +If the compiler reports an error, fix that first. Do not start a new test run until compilation succeeds. |
| 59 | + |
| 60 | +> [!TIP] |
| 61 | +> If you expect to make several small edits in a row, `gh aw compile --watch` can speed up the loop by recompiling after each save. |
| 62 | +
|
| 63 | +## Commit Both Workflow Files |
| 64 | + |
| 65 | +After `gh aw compile` succeeds, commit both the source workflow and the regenerated lock file: |
| 66 | + |
| 67 | +```bash |
| 68 | +git add .github/workflows/daily-status.md .github/workflows/daily-status.lock.yml |
| 69 | +git commit -m "refine daily-status workflow output" |
| 70 | +git push |
| 71 | +``` |
| 72 | + |
| 73 | +If your workflow uses a different filename, stage that `.md` file and its matching `.lock.yml` file instead. |
| 74 | + |
| 75 | +## Trigger a Fresh Run and Compare |
| 76 | + |
| 77 | +Use **workflow_dispatch** from the **Actions** tab to trigger a new run. Then compare the latest result with the previous one. |
| 78 | + |
| 79 | +Ask yourself: |
| 80 | + |
| 81 | +- Did the new run reflect the change you made? |
| 82 | +- Is the output more useful than before? |
| 83 | +- Did you improve the original problem without creating a new one? |
| 84 | + |
| 85 | +If yes, keep the change. If not, revert the change and try a different adjustment. |
| 86 | + |
| 87 | +If you want a stricter review loop, score each run for accuracy, completeness, and tone before you decide what to change next. |
| 88 | + |
| 89 | +## ✅ Checkpoint |
| 90 | + |
| 91 | +- [ ] I identified one specific problem from a real workflow run |
| 92 | +- [ ] I changed only one instruction or configuration detail before testing again |
| 93 | +- [ ] I ran `gh aw compile` after the edit and before triggering the next run |
| 94 | +- [ ] I committed both the workflow `.md` file and the regenerated `.lock.yml` file |
| 95 | +- [ ] I compared the new run with the previous run and decided what to change next |
| 96 | + |
| 97 | +<!-- journey: all --> |
| 98 | +**Next:** [What's Next? Keep Exploring](14-next-steps.md) |
| 99 | +<!-- /journey --> |
0 commit comments