Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push event fails due to no returned data #288

Open
micahriggan opened this issue Sep 27, 2024 · 0 comments
Open

push event fails due to no returned data #288

micahriggan opened this issue Sep 27, 2024 · 0 comments

Comments

@micahriggan
Copy link

micahriggan commented Sep 27, 2024

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"
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

No branches or pull requests

1 participant