Skip to content

fix: emit dependabot.yml without YAML anchors#27

Merged
avrabe merged 1 commit intomainfrom
fix/dependabot-yaml-norefs
Apr 26, 2026
Merged

fix: emit dependabot.yml without YAML anchors#27
avrabe merged 1 commit intomainfrom
fix/dependabot-yaml-norefs

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 26, 2026

Root cause

The bot-generated `.github/dependabot.yml` in PR #25 was rejected by GitHub's dependabot parser because `js-yaml`'s default `dump()` deduplicates the shared `labels: ['dependencies']` array using YAML anchors (`&ref_0` / `*ref_0`). Valid YAML, invalid dependabot.yml.

Fix

Pass `{ noRefs: true }` to `yaml.dump` in:

  • `src/dependabot.js:26` — the upsert/PR path that writes the file
  • `src/app.js:465` — the `/generate-dependabot` ChatOps preview block

Regression test added: constructs a config with two updates sharing a labels array, asserts dumped output contains neither `&ref_` nor `*ref_`.

Test plan

  • 753 tests pass (was 752, +1 regression)
  • eslint clean
  • After merge + self-update + close-and-reopen of [temper] Configuration update #25: bot's auto dependabot.yml passes the `.github/dependabot.yml` check.

Risk & rollout

  • Risk: low. Single serializer option. Semantically identical output.
  • Rollout: self-update on merge, then close [temper] Configuration update #25 so the bot regenerates clean on the next PR cycle.

🤖 Generated with Claude Code

## Root cause
The bot-generated `.github/dependabot.yml` in PR #25 was rejected by
GitHub's dependabot parser:

```yaml
labels: &ref_0
  - dependencies
...
labels: *ref_0
```

`js-yaml`'s default `dump()` deduplicates repeated structures (here, the
shared `['dependencies']` labels array) using YAML anchors / aliases
(`&ref_0` / `*ref_0`). The construct is valid YAML, but GitHub's
dependabot.yml parser does not accept it — the `.github/dependabot.yml`
status check on the bot's auto-generated PRs FAILs.

## Fix
Pass `{ noRefs: true }` to `yaml.dump` in:
- `src/dependabot.js:26` — the upsert/PR path that writes the file
- `src/app.js:465` — the `/generate-dependabot` ChatOps preview block

Added a regression test (`emits dependabot.yml without YAML anchors even
when labels are shared across updates`) that constructs a config with two
updates sharing the same `labels` array and asserts the dumped output
contains neither `&ref_` nor `*ref_`.

## Test plan
- [x] All 753 tests pass (was 752 — added 1 regression test)
- [x] eslint clean
- [ ] After merge + self-update + close-and-reopen of #25: the bot's
      auto-generated dependabot.yml passes GitHub's `.github/dependabot.yml`
      check.

## Risk & rollout
- Risk: low. Single-option change to a YAML serializer call. The output is
  semantically identical — only the wire format changes.
- Rollout: self-update on merge. Then close PR #25 (if still open) so the
  bot regenerates a clean version on the next non-bot PR cycle.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 883850a into main Apr 26, 2026
5 checks passed
@avrabe avrabe deleted the fix/dependabot-yaml-norefs branch April 26, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant