ubiquity-os / ubiquity-os-kernel

1 stars 13 forks source link

The kernel doesn't call `compute.yml` of the specified plugin PR #76

Closed rndquu closed 2 months ago

rndquu commented 2 months ago

Check this bot's config. It's trying to call the pull/1 branch of the https://github.com/rndquu/automated-merging/ repository.

At the time of creating this issue the development (default) branch of the https://github.com/rndquu/automated-merging/ repository doesn't have the compute.yml file. The compute.yml file is introduced only in this PR.

The thing is that although the config is set to call the pull/1 branch (where compute.yml exists) the kernel somehow throws this error:

✘ [ERROR] Error in event handler RequestError [HttpError]: Not Found - https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event

      at null.<anonymous>
  (file:///Users/rndquu/Public/projects/backend/ubiquibot-kernel/node_modules/@octokit/request/dist-bundle/index.js:106:21)
      at async sendRequestWithRetries
  (file:///Users/rndquu/Public/projects/backend/ubiquibot-kernel/node_modules/@octokit/auth-app/dist-node/index.js:365:12)
      at async Job.doExecute
  (file:///Users/rndquu/Public/projects/backend/ubiquibot-kernel/node_modules/bottleneck/light.js:405:18)
  {
    status: 404,
    request: {
      method: 'POST',
      url:
  'https://api.github.com/repos/rndquu/automated-merging/actions/workflows/compute.yml/dispatches',
      headers: {
        accept: 'application/vnd.github.v3+json',
        'user-agent': 'octokit-core.js/6.1.2 Cloudflare-Workers',
        authorization: 'token [REDACTED]',
        'content-type': 'application/json; charset=utf-8'
      },
      body:
  '{"ref":"pull/1","inputs":{"stateId":"7f2f9d4d-a9db-4a3f-81dd-7842403848b2","eventName":"issue_comment.created","eventPayload":"{\\"action\\":\\"created\\",\\"issue\\":{\\"url\\":\\"https://api.github.com/repos/rndquu-org/test-repo/issues/63\\",\\"repository_url\\":\\"https://api.github.com/repos/rndquu-org/test-repo\\",\\"labels_url\\":\\"https://api.github.com/repos/rndquu-org/test-repo/issues/63/labels{/name}\\",\\"comments_url\\":\\"https://api.github.com/repos/rndquu-org/test-repo/issues/63/comments\\",\\"events_url\\":\\"https://api.github.com/repos/rndquu-org/test-repo/issues/63/events\\",\\"html_url\\":\\"https://github.com/rndquu-org/test-repo/issues/63\\",\\"id\\":2410418452,\\"node_id\\":\\"I_kwDOJjwW986PrBEU\\",\\"number\\":63,\\"title\\":\\"Test

...other output

response: {
      url:
  'https://api.github.com/repos/rndquu/automated-merging/actions/workflows/compute.yml/dispatches',
      status: 404,
      headers: {
        'access-control-allow-origin': '*',
        'access-control-expose-headers': 'ETag, Link, Location, Retry-After,
  X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource,
  X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type,
  X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
        'content-length': '140',
        'content-security-policy': "default-src 'none'",
        'content-type': 'application/json; charset=utf-8',
        date: 'Tue, 16 Jul 2024 15:02:20 GMT',
        'referrer-policy': 'origin-when-cross-origin,
  strict-origin-when-cross-origin',
        server: 'github.com',
        'strict-transport-security': 'max-age=31536000; includeSubdomains;
  preload',
        vary: 'Accept-Encoding, Accept, X-Requested-With',
        'x-accepted-github-permissions': 'actions=write',
        'x-content-type-options': 'nosniff',
        'x-frame-options': 'deny',
        'x-github-api-version-selected': '2022-11-28',
        'x-github-media-type': 'github.v3; format=json',
        'x-github-request-id': '6B8E:2FE76F:10D77138:110C6634:66968B7C',
        'x-ratelimit-limit': '5800',
        'x-ratelimit-remaining': '5791',
        'x-ratelimit-reset': '1721145362',
        'x-ratelimit-resource': 'core',
        'x-ratelimit-used': '9',
        'x-xss-protection': '0'
      },
      data: {
        message: 'Not Found',
        documentation_url:
  'https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event',
        status: '404'
      }
    }
  }

The expected behavior is that compute.yml is called from the pull/1 branch.

rndquu commented 2 months ago

@gentlementlegen Pls check the description

gentlementlegen commented 2 months ago

@rndquu I think this is an expected behavior, because when the workflow is missing from the main branch it cannot be triggered by any sort of dispatch. I will see if I can replicate this behavior, but I think that if you add a manual workflow_dispatch you cannot use Github's UI to manually trigger it either, if it is not present in the default branch.

gentlementlegen commented 2 months ago

Here is the result of my research:

I created this repository, which is a fork of assistive-pricing repo. Default branch is develop, another branch is main. Within develop I deleted the compute file. Main has that compute file.

My configuration looks like:

  - uses:
    - plugin: Meniole/test-automated-merging@main
      with:
        approvalsRequired:
          collaborator: 1
        mergeTimeout:
          collaborator: "2 minutes"

Supposedly, it should call the compute located within main. But on run I get

{
      "message": [
        "Error in event handler",
        "HttpError: Not Found - https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event"
      ],
      "level": "error",
      "timestamp": 1721191885993
    }

We can also notice that the workflow is missing from Github's UI despite having a workflow_dispatch image

This confirms the documentation, stating

This trigger only receives events when the workflow file is on the default branch.

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatch

I don't think there is a workaround. The workflow has to be present in the default branch.

rndquu commented 2 months ago

@gentlementlegen Thank you very much for the research. I see, so it's not the kernel bug but expected behavior and the docs explicitly say that the workflow file should be located in the default branch.

ubiquibot[bot] commented 2 months ago
# Issue was not closed as completed. Skipping.
ubiquibot-dev[bot] commented 2 months ago
# Issue was not closed as completed. Skipping.