ad-m / github-push-action Goto Github PK
View Code? Open in Web Editor NEWGitHub actions to push back to repository eg. updated code
License: MIT License
GitHub actions to push back to repository eg. updated code
License: MIT License
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Commit changes" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
this only committed a file content change and ignored a new file that was added.
My action
- name: Push changes to MouseFM-Backend
uses: ad-m/github-push-action@master
with:
repository: matmu/MouseFM-Backend
directory: MouseFM-Backend
github_token: ${{ secrets.DEPLOY_PRIVATE_KEY }}
results in an error. The directory, secrets.DEPLOY_PRIVATE_KEY and the repository exists. What is wrong?
Run ad-m/github-push-action@master
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch master
warning: url contains a newline in its host component: https://matmu:***
***
***
***
***
***
***
***
***
***
@github.com/matmu/MouseFM-Backend.git/
fatal: credential url cannot be parsed: https://matmu:***
***
***
***
***
***
***
***
***
@github.com/matmu/MouseFM-Backend.git/
Error: Invalid status code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
code: 128
}
Error: Invalid status code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Triggers on this test suite (see Equality test -> Push changes):
https://github.com/CrafterKolyan/mmp-practicum-sql-fall-2019/commit/fec767484cd65bef7564526340b6e2685f5a91fc/checks?check_suite_id=270034433
Works perfectly for (see Equality test -> Push changes):
https://github.com/CrafterKolyan/mmp-practicum-sql-fall-2019/commit/a40d5ea52e0ba5c5075ae1a4ad51bc133ead1fd7/checks?check_suite_id=270116816
The only real difference between this 2 test suites is that first was working for more than 1 hour, while 2nd one done his job in 5 minutes. I used github push action @ master
. Will change to v.0.4.0
to see if this bug will occur again.
Is this known bug?
It would also be nice, if tags: true
(default: false
) could be configured.
Same same as #2, but different.
Hi! Today I was trying to play around with some updates using github-push-action
and I noticed I was getting the error:
##[warning]Unexpected input 'github-token', valid inputs are ['github_token', 'repository', 'branch', 'force', 'tags', 'directory']
I was quite confused by this until I read closer and noticed that I had used github-token
in
- name: Push changes
uses: ad-m/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
instead of github_token
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
As the GitHub github-script
action uses github-token
, would you consider changing the input to match them? My library is probably not the only one that uses both github-script
and github-push-action
so it would probably lead to less typos and errors. If there was a reason that you intentionally chose to not copy them then my apologies for missing this.
I also just wanted to say thank you, as your GitHub Action is awesome and we use it quite heavily in our publication workflow for our library pyhf
.
Hi,
forgive my retardedness.
someone made a fork of my repo to make a contribution. They've made a PR on my repo and the push action fails with the following error.
Run ad-m/github-push-action@master
with:
github_token: ***
branch: patch-1
directory: .
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.5/x64
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch patch-1
remote: Permission to DarkThemeHub/GithubDarkTheme.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/DarkThemeHub/GithubDarkTheme.git/': The requested URL returned error: 403
The script works fine if its a PR created from a branch in origin.
I feel like the error isnt actually correct since it works fine for branches in origin repo.
Is this just the case that i have to include github-actions[bot] as a contributor to get it working with a PR from a forked branch?
Or is it the case that forked branch's action is trying to push to a branch in origin which does not exist?
Or is it something else?
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Generate test style
run: |
python Scripts/GenerateStylusTestFile.py
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Generate Test Style Files" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
I'm trying to create a workflow that generates a file and then commits this file. This should happen on a separate branch and be merged when the action is complete. I currently use another action to merge and delete the branch.
workflow.yaml
- name: Add changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Add pipeline" -a
- name: Commit
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.HEAD_REF }}
- name: Merge and delete branch
uses: estensen/auto_merge_my_pull_requests@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
When I specify branch: ${{ github.HEAD_REF }}
an extra commit is created where some merging is done.
With branch: ${{ github.BRANCH }}
the branch is merged and then the commit is applied.
With branch: ${{ github.REF }}
I get the error:
Push to branch refs/pull/25/merge
To https://github.com/estensen/python-actions.git
! [remote rejected] HEAD -> refs/pull/25/merge (deny updating a hidden ref)
error: failed to push some refs to 'https://estensen:***@github.com/estensen/python-actions.git'
Overview here.
Is it possible to have the commit happen on the branch without creating the extra merge commit?
We can add our Github Action on https://github.com/boyney123/github-actions after merging #10.
Context:
Was checking out multiple private repos and was copying a file from a private repos to a public repos in the workspace, then committing and pushing. The push would fail with a 403.
Error:
remote: Permission to my-repos denied to github-actions[bot].
fatal: unable to access 'https://github.com/.../my-repos.git/': The requested URL returned error: 403
By running this command we can see any of config settings being used for our repos:
git config -l
We discovered the checkout action is executing a command like this:
git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
Reference:
https://github.com/actions/checkout/blob/master/adrs/0153-checkout-v2.md#pat
The fix is to do this:
git config --local --unset-all "http.https://github.com/.extraheader"
It's seems unlikely that this could lead to side effects but it may be desirable to re-set this value after the push is completed.
Sorry for lack of PR, we ended up not using your action and just incorporated what we ended into our workflow file.
It would be nice to add a documentation about what inputs people can use, for not it's probably github_token
and branch
, might be force
(#2) etc. in the future.
๐
This is especially the case if you try to push a tag and a commit at the same time. I believe a possible resolution would simply be to pull before a push. Perhaps an extra configuration item for those fearing this could be useful?
Created in error; delete
Hey cool action here. :)
I've used it without problem until now... doing an actual release, of course. ๐
The problem is that our repo has protected branch rules, and is getting an error when push occurs:
https://github.com/ExtendedXmlSerializer/home/runs/330624066
(Under Push Changes
)
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch master
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: Required status check "continuous-integration/appveyor/pr" is expected.
To https://github.com/ExtendedXmlSerializer/home.git
! [remote rejected] HEAD -> master (protected branch hook declined)
error: failed to push some refs to '***github.com/ExtendedXmlSerializer/home.git'
Here is our configuration:
https://github.com/ExtendedXmlSerializer/home/blob/47f7567de9a45f849ffa106bd391d11026b8a2eb/.github/workflows/publish-release-build.yml#L49-L52
The thought to set force: true
strikes me, but I am not sure that this will fix the problem. The other issue is that I do not want to do a force push from CI as this seems to be asking for more trouble. ๐
I thought secrets.GITHUB_TOKEN
had administrator privileges but that does not appear to be the case. Is there another setting to consider here? Any suggestions/guidance would be greatly appreciated.
I am going to turn off branch protections for now and in the meantime so I can get this sucker deployed.
If I use this action on push to master and use it to push to same repository, will it cause an infinite loop? If it does, is there a recommended strategy to avoid it?
For context, my use case is, in my repo, which is an Angular app, I want to build and deploy the app to /docs
path once I push changes to the app.
PS - I totally understand that this is not an issue with the library and is a question; since there's no forum like Gitter / Slack for this repo, raising an issue here for attention.
Hi!
I want to push only a specific folder but everything is pushed instead. This is my workflow:
- name: Commit files
run: |
git config --local user.email "~email~"
git config --local user.name "~name~"
git add Output/
git commit -m "update"
- name: GitHub Push
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.githubToken }}
repository: ~repo~
force: true
directory: 'Output'
Am I doing something wrong? ๐ค
The README.md doesn't say anything about how to specify the input values. I'm sure that somewhere buried in the github action docs that's explain but please put the actual steps necessary in the README.md so that people don't have to hunt for hours to find them (I know I still haven't).
I have an action to build some frontend files (webpack/gulp/less), and commit them back to the repo.
The push is failing:
Run ad-m/github-push-action@master
with:
github_token: ***
branch: origin HEAD
directory: .
env:
CI: true
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch origin HEAD
To https://github.com/animeplanet/ap-main.git
1e4fca86d..0ad8fbe14 HEAD -> dm-action
! [rejected] HEAD -> origin (non-fast-forward)
error: failed to push some refs to '***github.com/animeplanet/ap-main.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Error: Invalid status code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
code: 1
}
Error: Invalid status code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
There is a git status
command just prior to trying the push which shows the repo is up-to-date:
Run git status
git status
shell: /bin/bash -e {0}
On branch dm-action
Your branch is ahead of 'origin/dm-action' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
My Build yaml:
name: BuildCssJs.js CI
on:
push:
branches:
- 'dm-action'
- 'staging'
- 'dark-mode-fixes'
- 'manga-chapters'
- 'carousel-fix'
- 'characters-edit-actions'
- 'responsive-carousels'
paths:
- '.github/workflows/*'
- 'gulpfile.js'
- 'webpack.*'
- 'src/assets/**/*'
- 'public_html/inc/**/*.js'
- 'public_html/inc/**/*.less'
- '!public_html/inc/dist/**/*'
- '!public_html/inc/*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run ci --if-present
- run: git status
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Built CSS/JS - $(git rev-parse --short HEAD)"
- run: git pull
- run: git status
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: 'origin HEAD'
env:
CI: true
I've got two repo's: test_workflow en test_workflow_dev. Repo test_workflow runs an ant-build and puts the result in directory output. I only want to push the content of directory output to repository test_workflow_dev. My yaml-file looks like this:
name: push output
on:
push:
paths:
- 'input/**.docx'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Ant
run: ant -noinput -buildfile build.xml -lib ./lib
- name: Commit files
run: |
git config --local user.email [mail]
git config --local user.name [user]
git add ./output
git commit -m "Update output"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.USER_TOKEN }}
directory: './output'
repository: '[user]/test_workflow_dev'
When I use 'force: true' the whole repo test_workflow is pushed, not only output, but I get no errors. When I omit 'force: true', I get errors:
Run ad-m/github-push-action@master
with:
github_token: ***
directory: ./output
repository: [user]/test_workflow_dev
branch: master
env:
JAVA_HOME: /opt/hostedtoolcache/jdk/8.0.252/x64
JAVA_HOME_8.0.252_x64: /opt/hostedtoolcache/jdk/8.0.252/x64
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch master
To https://github.com/[user]/test_workflow_dev.git
! [rejected] HEAD -> master (fetch first)
error: failed to push some refs to 'https://github.com/[user]/test_workflow_dev.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Error: Invalid status code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
code: 1
}
Error: Invalid status code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
Is this a bug or am I doing something wrong? I hope it's the last.
Help appreciated.
It gives an error and shows action failed when there is nothing to commit
nothing to commit, working tree clean
##[error]Process completed with exit code 1.
My custom action performed some action and in the end, there were no changes to be pushed.
The subsequent action (ad-m/github-push-action) failed.
It should skip and show the success if there are no changes.
It would be nice, if force: true
(default: false
) could be configured.
Hi, can you add a parameter where it wont fail the build if nothing was commited?
Cheers
Hey
I have some problems using push actions. First, no push would happen because of not pulled beforehand but found the solution to that. Now it can not access the GitHub API. I have set the GitHub token and everything. The Repo is private.
Error: Invalid status code '404' for url 'https://api.github.com/repos/<USER>/<REPO>'
at IncomingMessage.<anonymous> (/home/runner/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: 'Tue, 05 Jan 2021 06:13:21 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': '59',
'x-ratelimit-reset': '1609830801',
'x-ratelimit-used': '1',
'content-length': '107',
connection: 'close',
'x-github-request-id': '07C0:70A3:5627175:C8346CC:5FF40381'
},
rawHeaders: [
'server',
'GitHub.com',
'date',
'Tue, 05 Jan 2021 06:13:21 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',
'59',
'X-Ratelimit-Reset',
'1609830801',
'X-Ratelimit-Used',
'1',
'Content-Length',
'107',
'Connection',
'close',
'X-GitHub-Request-Id',
'07C0:70A3:5627175:C8346CC:5FF40381'
],
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/DatStorm/crossfit-wod 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/DatStorm/crossfit-wod',
_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":"https://docs.github.com/rest/reference/repos#get-a-repository"}'
}
Error: Invalid status code '404' for url 'https://api.github.com/repos/<USER>/<REPO>'
at IncomingMessage.<anonymous> (/home/runner/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)
When trying to push to a private repository (the same repo that the action is run from), I get a "fatal: repository 'https://github.com//.git/' not found". I've tried using both secrets.GITHUB_TOKEN, and a PAT (via secrets.DEPLOY_PAT). I'm not sure if I'm doing somethign wrong, but I suspect that it might come down to the repo being private.
From #36:
https://github.com/ExtendedXmlSerializer/home/runs/330624066
(Under Push Changes
)
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch master
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: Required status check "continuous-integration/appveyor/pr" is expected.
To https://github.com/ExtendedXmlSerializer/home.git
! [remote rejected] HEAD -> master (protected branch hook declined)
error: failed to push some refs to '***github.com/ExtendedXmlSerializer/home.git'
Here is our configuration:
https://github.com/ExtendedXmlSerializer/home/blob/47f7567de9a45f849ffa106bd391d11026b8a2eb/.github/workflows/publish-release-build.yml#L49-L52
The action encountered an error, but it still passed as if an error did not occur. Ideally, the job should fail if the action encountered any error while attempting to complete its primary objective.
Please let me know if I have something fundamentally misunderstood and/or configured incorrectly.
The following error can happen at random especially for jobs in parallel (matrix). This could be related to race condition.
Run ad-m/github-push-action@master
with:
branch: refs/heads/optimize-strategy-ac
github_token: ***
directory: .
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch refs/heads/optimize-strategy-ac
To https://github.com/EA31337/EA31337-Lite-optimization-tests.git
! [remote rejected] HEAD -> optimize-strategy-ac (cannot lock ref 'refs/heads/optimize-strategy-ac': is at 98bf7e54a615d7e23cbcf8688d22c4099a1d2240 but expected 00da1b358846ae9a8ffa71b34eb1e330e3a37e3d)
error: failed to push some refs to 'https://github.com/EA31337/EA31337-Lite-optimization-tests.git'
Error: Invalid status code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
code: 1
}
Error: Invalid status code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
My config:
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
# Otherwise, you will failed to push refs to dest repo.
fetch-depth: 0
- run: docker-compose run $DCA ${{ matrix.test }}
- name: Commit files
run: |
git config --local core.autocrlf false
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git pull origin ${{ github.ref }} --autostash --rebase -Xours
git add --renormalize .
git status
git commit -am "${{ github.workflow }}"
- name: Git Diff
run: NO_PAGER=1 git --no-pager diff HEAD^
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
I don't want to force push (because obviously something changed upstream right after the pull), so maybe integrating pull feature as well right before push could be useful and do some customizable number of retries?
One workaround is to move push action outside of matrix jobs by uploading changed from from matrix job, then downloading artifacts (e.g. patches) and push the changes at the final stage.
I have two branches in my repo, "master" and "branch2". I also have two separate workflows, one for each branch, and each of them is triggered by a push on that specific branch. The thing is that I am using this action here inside master's workflow to push some changes to "branch2". The push is working very well, but the problem is that it is not triggering the workflow on "branch2" as it should, while pushing manually from github does. What might be the issue?
can't push to branch with only include target directory contents
when i use directory
option it still push full repo content
I guess the reason might be related to the recent commits which switch from start.sh to start.js something.
Maybe in the readme, do not suggest users to use ad-m/github-push-action@master
, but a specific version such as ad-m/[email protected]
The reason for this is because i was having hair pulling troubles trying to figure out how to get this action to push to the branch that triggered the script. Due to the complexity of github actions.
In addition, this Action name's "intent" is just push, which by default I would expect it to only push on the triggered branch, not merge to master.
Either it should by default push to trigger branch or give the example to do so in the readme file.
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
My build ended with some error about node and execution of bash. See below for the error, I have no clue why that happened. (Here is the workflow).
I'm tried both version v0.5.0 and master but both resulted in this error.
Run ad-m/[email protected]
/usr/bin/docker run --name db5fe1103094c46ebac7adf9bcbc7dfbf_252f05 --label 10865d --workdir /github/workspace --rm -e INPUT_GITHUB_TOKEN -e INPUT_REPOSITORY -e INPUT_BRANCH -e INPUT_FORCE -e INPUT_DIRECTORY -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/ci-fiddle/ci-fiddle":"/github/workspace" 10865d:b5fe1103094c46ebac7adf9bcbc7dfbf
Push to branch master
Info: can't find node in PATH, trying to find a node binary on your system
env: can't execute 'bash': No such file or directory
error: failed to push some refs to '***github.com/vidavidorra/ci-fiddle.git'
##[error]Docker run failed with exit code 1
Ok, I may be being really dumb here but
I get permission denied
my workflow file:
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Main Checkout
- uses: actions/checkout@v2
name: Secondary Checkout
with:
repository: sabuto/bot-test2
path: bot-test2
- name: move file to other repo
run: \cp -Rv .github/sabubot.yml bot-test2/.github/sabubot.yml
- name: commit to local
run: |
cd bot-test2
git config --local user.email "[email protected]"
git config --local user.name "sabuto"
git add .
git commit -m "Add changes"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_PSA }}
repository: sabuto/bot-test2
I have the psa key setup in the repo that is triggering the workflow
which is a personal access token with all rights.
In the
https://github.com/ad-m/github-push-action/blob/master/action.yml#L12
and
https://github.com/ad-m/github-push-action/blame/master/README.md#L35
there is interpolation used as {{ secrets.GITHUB_TOKEN }}
and ${GITHUB_REPOSITORY}
.
From the docs I think it should be ${{ <expression> }}
. Should we change it to make it right?
Thanks for creating the action.
The ReadMe suggests using @master
for the version, but that's a bit risky stability wise for users. Offering a major version tag would provide stability for users, assuming you follow semver.
You can accomplish this on each release with:
git tag v0.7.0
git push origin v0.7.0
git tag -fa v0 -m "Update v0 tag"
git push origin v0 --force
Then the README could say:
- name: Push changes
uses: ad-m/github-push-action@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
I've been using this action for some time and it consistently builds in ~17 seconds. Any idea of how we can make it faster?
I have an action (triggered on all pushes) which runs a particular coverage tool and generates a badge which I have included in my README. I use this action after the coverage tool to commit the new badge (with the new percentage). I also have a number of other actions that are also triggered on pushes.
What's great is that github seems to be intelligent enough that pushing the new badge does not trigger these actions a second time. However, when I push to a branch that has a pull request already open, this new push of the badge is taken as the latest commit and results in multiple pending checks instead being shown indefinitely on the pull request instead of using the checks from the original commit. This basically means having to close and reopen the pull request. And generally being unable to push to branches with open PRs.
My question is whether there is any way of getting around this? It doesn't seem like other people have experienced the same problem. Thanks!
Hi,
I can't get this working and I'm not sure why.
I'm using php cs fixer to change the code and then I want to push the changes, but I'm getting following error:
Push to branch master
fatal: remote origin already exists.
Everything up-to-date
My workflow:
on: push
name: Main
jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --diff
- name: commit
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: .
I'd like to push to my another repo
My action looks like this below:
...
- name: Commit files
working-directory: ./dist
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "update blog" -a
- name: Push changes as deploy
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PUSH_SECRET_FOR_ACTION }}
force: true
repository: "me.github.io"
And my repo's secret looks like this which value is from Personal Access Token:
I've also read this related issue about How to set GITHUB_TOKEN
But I still failed. Is there sth I've been misunderstanding ? Hope to get an answer, thanks.
I'm running a build on Mac OS and try to push changes back with the following config:
jobs:
release:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
...
- name: Set up GitHub Actions git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: do changes
run: ...
- name: Push maven-release-plugin changes
uses: ad-m/[email protected]
with:
tags: true
github_token: ${{ secrets.GITHUB_TOKEN }}
However, this results in an error:
Push maven-release-plugin changes
Run ad-m/[email protected]
with:
tags: true
github_token: ***
branch: master
directory: .
env:
JAVA_HOME: /Users/runner/hostedtoolcache/jdk/8.0.242/x64
JAVA_HOME_8.0.242_x64: /Users/runner/hostedtoolcache/jdk/8.0.242/x64
##[error]Container action is only supported on Linux
Why is it not supported on Mac OS? Does anyone have a workaround for that?
Thanks for your help and all the best,
Tobias
Out of the blue today my workflow stopped working at push to repo step.
It gives me the following error:
Run ad-m/github-push-action@master
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch master
remote: Permission to ***/sunday-night-wreckfest.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/***/sunday-night-wreckfest.git/': The requested URL returned error: 403
Error: Invalid status code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
code: 128
}
Error: Invalid status code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
I have use the same workflow without changes for a couple of weeks and today I suddenly started encountering this problem.
Here's also my workflow:
name: Test and Deploy
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
env:
working-directory-be: ./backend
working-directory-fe: ./frontend
GS_PRIVATE_KEY: ${{ secrets.GS_PRIVATE_KEY }}
GS_SERVICE_ACCOUNT_EMAIL: ${{ secrets.GS_SERVICE_ACCOUNT_EMAIL }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install backend dependencies
run: npm install
working-directory: ${{ env.working-directory-be }}
- name: Run tests
run: npm test
working-directory: ${{ env.working-directory-be }}
env:
CI: true
- name: Build backend
run: npm run build:server
working-directory: ${{ env.working-directory-be }}
- name: Install frontend dependencies
run: npm install
working-directory: ${{ env.working-directory-fe }}
- name: Build frontend
run: npm run build
working-directory: ${{ env.working-directory-fe }}
- name: Create production bundle
run: |
mkdir -p ./dist
cp -r ./backend/build/. ./dist
cp -r ./frontend/build/. ./dist/client
rm -r ./backend/build/
rm -r ./frontend/build/
cp ./backend/package.json ./dist/package.json
cp ./backend/package-lock.json ./dist/package-lock.json
cp ./backend/Procfile ./dist/Procfile
- name: Commit production bundle
run: |
git config --global user.name '${{ secrets.USERNAME }}'
git config --global user.email '${{ secrets.USERNAME }}@users.noreply.github.com'
git add .
git commit -m "Automated production bundle creation"
- name: Push production bundle to repo
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Push production bundle to dokku
uses: slinden2/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
dokku-ip-address: ${{ secrets.SERVER_IP }}
dokku-host: ***
app-name: ***
git-subtree-prefix: "dist"
force-push-subtree: "true"
push tags workflow:
My action :
name: foobar
on: [pull_request]
jobs:
hello_world_job:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get changed files
id: files
uses: jitterbit/get-changed-files@v1
with:
format: 'space-delimited'
- name: Action that add a new file in repo
...
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "Add changes" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
Error log :
Run ad-m/github-push-action@master
with:
github_token: ***
branch: gh-action-generate
directory: .
Push to branch gh-action-generate
To https://github.com/Kraymer/Simple-Repertoire.git
! [rejected] HEAD -> gh-action-generate (fetch first)
error: failed to push some refs to 'https://github.com/Kraymer/Simple-Repertoire.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Error: Invalid exit code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:29:21)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
code: 1
}
Error: Invalid exit code: 1
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:29:21)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Note: I did not commit in the remote branch after the commit that triggered the action
Due to the latest changes to Github, the default branches are now called "main" and not "master". Therefore, the default branch should be "main".
I'm confused as to how to pass the GITHUB_TOKEN
to your action. Is it as simple as adding a new Personal access token to settings -> tokens -> Personal access tokens
to my GitHub account? ^^
! [remote rejected] master -> master (refusing to allow a GitHub App to create or update workflow .github/workflows/build.yml
without workflows
permission)
using PAT keys where enabled workflow but still seeing this issue
Any Help would be appreciated
The JavaScript syntax is significantly faster than using a Dockerfile
. For a tool like this, it could be easy to make the conversion.
I did this in my fork from veggiemonk/skip-commit and I see gains of ~27 seconds:
The top build is after I switched to JS, the bottom is with a Dockerfile.
This makes sense: the old Docker image build step took ~25 seconds before I switched.
The action seems to fail if a pushed to branch does not already exist?
It would be useful if the branch was created in such a case.
This one is similar to #58 but the user did not show a working solution but instead closing out of the blue. This one also involves the workflow to commit to a different repository.
Anyways, Here's the error generated:
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch master
remote: Permission to JoshuaPelealu/catalactics-bot-docs.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/JoshuaPelealu/catalactics-bot-docs.git/': The requested URL returned error: 403
Error: Invalid status code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
code: 128
}
Error: Invalid status code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
And here is my workflow:
name: Update Readme
on:
push:
branches: [ master ]
jobs:
update_readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@master
with:
node-version: 12
- name: Clean Install Dependencies
run: npm ci
- name: Install Typescript
run: npm i typescript
- name: Install ts-node
run: npm i ts-node
- name: Run Script (update-readme)
run: npm run update-readme
env:
CI: true
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
MONGO_URI: ${{ secrets.MONGO_URI }}
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "Joshua Pelealu"
git add README.md
git commit -m "Auto Update README.md"
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: 'JoshuaPelealu/catalactics-bot-docs'
github_token: ${{ secrets.GITHUB_TOKEN }}
If anyone out there would be kind enough to help me :))...
Thanks in advance!!
why this?how to solve?
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: Series.m3u
[main 88744d7] PUSH TO Add changes
1 file changed, 9 insertions(+), 1 deletion(-)
remote: Repository not found.
Hi, thank you for a very useful action. I am new to GitHub action do i just want to ask about the example usage you have. I noticed that there is no git add .
in the section for 'Commit file'. Is that because you have the -a
in the git commit...
. Thank you very much for your help!
See also #79
This action works well for me, but occasionally I am running 2 of them at the same time and one will push changes in the middle of another one pulling the changes and then pushing.
It would be convenient if there was a pull_first: true
option that would re-issue the git pull
right before pushing to avoid a push conflict. Force is not the option as that will overwrite the other push changes (and ruin history).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.