Skip to content

Support for GitHub app to use ephemeral tokens #519

@v1v

Description

@v1v

If I use a GitHub app to create an Ephemeral GitHub token it's not working as expected

{
  "level": "info",
  "message": "Backporting options",
  "metadata": {
    "accessToken": "<REDACTED>",
    "assignees": [],
    "authenticatedUsername": "my-github-app[bot]",
    "author": "my-github-app[bot]",
    "autoAssign": false,
    "autoMerge": false,
    "autoMergeMethod": "merge",
    "backportBinary": "backport",
    "cherrypickRef": true,
    "commitConflicts": true,
    "commitPaths": [],
    "copySourcePRLabels": false,
    "copySourcePRReviewers": false,
    "cwd": "/home/runner/work/observability-robots-playground/observability-robots-playground",
    "dateSince": null,
    "dateUntil": null,
    "details": false,
    "draft": false,
    "fork": true,
    "gitHostname": "github.com",
    "interactive": false,
    "isRepoPrivate": true,
    "maxNumber": 10,
    "multipleBranches": true,
    "multipleCommits": false,
    "noVerify": true,
    "prDescription": "{defaultPrDescription} PRs are backported even if there are merge conflicts, please review them.",
    "publishStatusCommentOnAbort": false,
    "publishStatusCommentOnFailure": false,
    "publishStatusCommentOnSuccess": true,
    "pullNumber": 173,
    "repoForkOwner": "my-github-app[bot]",
    "repoName": "observability-robots-playground",
    "repoOwner": "my-org",
    "resetAuthor": false,
    "reviewers": [],
    "signoff": false,
    "sourceBranch": "main",
    "sourcePRLabels": [],
    "targetBranchChoices": [],
    "targetBranches": [
      "8.17"
    ],
    "targetPRLabels": [],
    "telemetry": true
  },
  "timestamp": "2024-12-12 14:51:34"
}

Then it uses my-github-app[bot]

{"level":"info","message":"Running command: \"git remote rm my-github-app[bot]\"","metadata":{},"timestamp":"2024-12-12 14:51:35"}

And it fails

{
  "level": "info",
  "message": "Running command: \"git push my-github-app[bot] backport/8.17/pr-173:backport/8.17/pr-173 --force\"",
  "metadata": {},
  "timestamp": "2024-12-12 14:51:37"
}

{
  "level": "error",
  "message": "runSequentially failed Code: 128, Args: \"push my-github-app[bot] backport/8.17/pr-173:backport/8.17/pr-173 --force\", Message: fatal: 'my-github-app[bot]' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.",
  "metadata": {
    "context": {
      "cmdArgs": [
        "push",
        "my-github-app[bot]",
        "backport/8.17/pr-173:backport/8.17/pr-173",
        "--force"
      ],
      "code": 128,
      "stderr": "fatal: 'my-github-app[bot]' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n",
      "stdout": ""
    },
    "name": "SpawnError",
    "stack": "SpawnError: Code: 128, Args: \"push my-github-app[bot] backport/8.17/pr-173:backport/8.17/pr-173 --force\", Message: fatal: 'my-github-app[bot]' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/backport/dist/lib/child-process-promisified.js:53:29)\n    at ChildProcess.emit (node:events:517:28)\n    at maybeClose (node:internal/child_process:1098:16)\n    at ChildProcess._handle.onexit (node:internal/child_process:303:5)\n    at Process.callbackTrampoline (node:internal/async_hooks:128:17)"
  },
  "timestamp": "2024-12-12 14:51:37"
}

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