fix: add updated workflow with corrected bot username and event handling

- Add 'opened' trigger to catch PRs when bot immediately applies label
- Fix bot username to github-actions[bot] (verified via API and commit history)
- Restructure condition to handle both 'labeled' and 'opened' events
  * 'labeled': uses github.event.label.name
  * 'opened': uses github.event.pull_request.labels.*.name
  * Prevents 'opened' event from failing due to missing github.event.label
This enables the auto-merge workflow to work with Speakeasy SDK generation PRs.
This commit is contained in:
Christine Chen
2026-06-22 11:59:27 -04:00
parent c34ce15fa2
commit add423f762
@@ -18,11 +18,17 @@ concurrency:
jobs:
auto-merge:
if: |
github.event.sender.login == 'app/github-actions' &&
github.event.pull_request.user.login == 'app/github-actions' &&
github.event.sender.login == 'github-actions[bot]' &&
github.event.pull_request.user.login == 'github-actions[bot]' &&
startsWith(github.event.pull_request.head.ref, 'speakeasy-sdk-regen-') &&
contains(github.event.pull_request.title, '🐝 Update SDK') &&
contains(fromJSON('["patch", "minor", "major"]'), github.event.label.name)
(
(github.event.action == 'labeled' && contains(fromJSON('["patch", "minor", "major"]'), github.event.label.name)) ||
(github.event.action == 'opened' &&
(contains(github.event.pull_request.labels.*.name, 'patch') ||
contains(github.event.pull_request.labels.*.name, 'minor') ||
contains(github.event.pull_request.labels.*.name, 'major')))
)
runs-on: ubuntu-latest
steps:
- name: Close superseded Speakeasy PRs