Skip to content

push event fails due to no returned data #288

Open
@micahriggan

Description

@micahriggan

await handleBaseBranchUpdate(context, eventName, eventData);

The push event handler function is only awaited and not returned. The function itself doesn't return anything anyway, so it would need to be modified to return something to fix this issue.

Since it's not returned, this causes the throw to be hit when processing a push event, since the result is undefined.

  if (Array.isArray(result)) {
    logger.info("More than one result, using  first result for action output");
    singleResult = result[0];
  } else if (result != null) {
    singleResult = result;
  } else {
    throw new Error("invalid result!");
  }

I am attempting to create pull requests to develop/staging when I merge to main, and then immediately merge all prs labeled auto-merge, but it seems like this step doesn't find all prs with the given label and merge them, it needs to be triggered by an event which would pass in the pullrequest number into the process. Is that correct or is there a way to just auto merge all the prs labeled automerge with this?

Here's what I'm trying to do atm

name: Sync branches
on:
  push:
    branches:
      - main

permissions:
  # Needed to read branches
  contents: read
  # Needed to create PR's
  pull-requests: write

jobs:
  sync-branches:
    runs-on: ubuntu-latest
    name: Syncing branches
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Node
        uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Opening develop pull request
        id: pull_develop
        uses: jdtx0/branch-sync@v1.5.1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PULL_REQUEST_AUTO_MERGE_METHOD: "merge"
          FROM_BRANCH: "main"
          TO_BRANCH: "develop"
          LABELS: '["automerge"]'
      - name: Opening staging pull request
        id: pull_staging
        uses: jdtx0/branch-sync@v1.5.1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PULL_REQUEST_AUTO_MERGE_METHOD: "merge"
          FROM_BRANCH: "main"
          TO_BRANCH: "staging"
          LABELS: '["automerge"]'
      - id: automerge
        name: automerge
        uses: "pascalgn/automerge-action@v0.16.4"
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          MERGE_LABELS: "automerge,!wip"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions