ad-m / github-push-action

GitHub actions to push back to repository eg. updated code
MIT License
1.21k stars 230 forks source link

Change default branch #69

Closed juancpineda97 closed 3 years ago

juancpineda97 commented 3 years ago

refs #68

emptymalei commented 3 years ago

This breaks all my old pipelines. Maybe the version number should be bumped.

ad-m commented 3 years ago

There is no release yet. Use latest version.

zhibek commented 3 years ago

@ad-m This merge also broke my pipeline too.

The examples for this action use uses: ad-m/github-push-action@master (in the README, etc) so I expect a lot of people will run into this issue.

I've changed my pipeline to uses: ad-m/github-push-action@v0.6.0 which I expect will also fix this for other people facing this problem.

Thanks for providing this action, it's been useful for me.

hanxiao commented 3 years ago

unfortunately, this change messed up our pipeline quite a lot. As in README it says uses: ad-m/github-push-action@master. People often copy paste and forget about it, without expecting such breaking change in master.

KonradLinkowski commented 3 years ago

This has broken a few of my workflows (I know that I should use strict version). Coudn't this branch be detected out of the repository?

ad-m commented 3 years ago

@KonradLinkowski , good idea :) It can be detected out of the repository via property default_branch in https://api.github.com/repos/hyperonecom/h1-cli .

ekeric13 commented 3 years ago

Is the autodiscovery working for anyone else? When i query api.github.com/repos/myOrg/myRepo I see the default_branch property as master so I expected it to work. Yet the github action is still failing with a 404. Currently set up to be ad-m/github-push-action@master but will just use the older version for now I guess. Just wondering if anyone can confirm on their side autodiscovery is working well since I know it was just merged in.

edit: thanks @ad-m for getting on this issue so quickly.

ad-m commented 3 years ago

@ekeric13 , could you provide logs? It works for me. See https://github.com/ad-m/cbosa/runs/1647095472?check_suite_focus=true and https://github.com/ad-m/cbosa/blob/d26298227758e3c9d9f83488b1d3d9bb4e07d21d/.github/workflows/cron.yml#L47-L50 .

ekeric13 commented 3 years ago

One difference between this workflow and yours is the myOrg/myRepo that I am pushing to is not the one the workflow is on. Workflow is triggered in myOrg/myRepo2, and updates myOrg/myRepo. Maybe that has something to do with it?

Run ad-m/github-push-action@master
  with:
    github_token: ***
    directory: myRepo
    repository: myOrg/myRepo
  env:
    GITHUB_SHORT_SHA: xxxxxx
Error: Invalid status code: 404
    at IncomingMessage.<anonymous> (/home/ubuntu/_work/_actions/ad-m/github-push-action/master/start.js:14:21)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  res: IncomingMessage {
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: null,
      pipesCount: 0,
      flowing: true,
      ended: true,
      endEmitted: true,
      reading: false,
      sync: true,
      needReadable: false,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      paused: false,
      emitClose: true,
      autoDestroy: false,
      destroyed: false,
      defaultEncoding: 'utf8',
      awaitDrain: 0,
      readingMore: true,
      decoder: null,
      encoding: null
    },
    readable: false,
    _events: [Object: null prototype] { end: [Array], data: [Function] },
    _eventsCount: 2,
    _maxListeners: undefined,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      _SNICallback: null,
      servername: 'api.github.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 9,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.github.com',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(asyncId)]: 3,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    connection: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      _SNICallback: null,
      servername: 'api.github.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 9,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.github.com',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(asyncId)]: 3,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    httpVersionMajor: 1,
    httpVersionMinor: 1,
    httpVersion: '1.1',
    complete: true,
    headers: {
      server: 'GitHub.com',
      date: 'Mon, 04 Jan 2021 19:07:55 GMT',
      'content-type': 'application/json; charset=utf-8',
      status: '404 Not Found',
      'x-github-media-type': 'github.v3; format=json',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
      'access-control-allow-origin': '*',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      'x-frame-options': 'deny',
      'x-content-type-options': 'nosniff',
      'x-xss-protection': '1; mode=block',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      'content-security-policy': "default-src 'none'",
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-ratelimit-limit': '60',
      'x-ratelimit-remaining': '58',
      'x-ratelimit-reset': '1609790758',
      'x-ratelimit-used': '2',
      'content-length': '107',
      connection: 'close',
      'x-github-request-id': '94D0:4F4D:6075F8:12557ED:5FF3678B'
    },
    rawHeaders: [
      'server',
      'GitHub.com',
      'date',
      'Mon, 04 Jan 2021 19:07:55 GMT',
      'content-type',
      'application/json; charset=utf-8',
      'status',
      '404 Not Found',
      'x-github-media-type',
      'github.v3; format=json',
      'access-control-expose-headers',
      'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
      'access-control-allow-origin',
      '*',
      'strict-transport-security',
      'max-age=31536000; includeSubdomains; preload',
      'x-frame-options',
      'deny',
      'x-content-type-options',
      'nosniff',
      'x-xss-protection',
      '1; mode=block',
      'referrer-policy',
      'origin-when-cross-origin, strict-origin-when-cross-origin',
      'content-security-policy',
      "default-src 'none'",
      'vary',
      'Accept-Encoding, Accept, X-Requested-With',
      'X-Ratelimit-Limit',
      '60',
      'X-Ratelimit-Remaining',
      '58',
      'X-Ratelimit-Reset',
      '1609790758',
      'X-Ratelimit-Used',
      '2',
      'Content-Length',
      '107',
      'Connection',
      'close',
      'X-GitHub-Request-Id',
      '94D0:4F4D:6075F8:12557ED:5FF3678B'
    ],
    trailers: {},
    rawTrailers: [],
    aborted: false,
    upgrade: false,
    url: '',
    method: null,
    statusCode: 404,
    statusMessage: 'Not Found',
    client: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      _SNICallback: null,
      servername: 'api.github.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 9,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.github.com',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(asyncId)]: 3,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    _consuming: false,
    _dumped: false,
    req: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      connection: [TLSSocket],
      _header: 'GET /repos/myOrg/myRepo HTTP/1.1\r\n' +
        'User-Agent: github.com/ad-m/github-push-action\r\n' +
        'Host: api.github.com\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      path: '/repos/myOrg/myRepo',
      _ended: true,
      res: [Circular],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      [Symbol(kNeedDrain)]: false,
      [Symbol(isCorked)]: false,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    }
  },
  body: '{"message":"Not Found","documentation_url":"docs.github.com/rest/reference/repos#get-a-repository"}'
}
Error: Invalid status code: 404
    at IncomingMessage.<anonymous> (/home/ubuntu/_work/_actions/ad-m/github-push-action/master/start.js:14:21)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)