-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fatal: You are not currently on a branch. To push the history leading to the current (detached HEAD) #719
Comments
Seems like things changed in v3 and this is what I have in the log:
This also means that the https://github.com/actions/checkout#Push-a-commit-using-the-built-in-token section is not correct anymore. |
I was able to get it to work with v3: - uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- run: |
date >generated.txt
git config user.name github-actions
git config user.email [email protected]
git add --all .
git commit --message test
git push If the commit should trigger workflows things get more complicated and a personal access token (PAT) is required: - uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.pat }}
- run: |
date >generated.txt
user=$(gh api /user)
user_name=$(jq -r '.login' <<<"$user")
user_email=$(jq -r ".email | \"[email protected]\"" <<<"$user")
git config user.name "$user_name"
git config user.email "$user_email"
git add --all .
git commit --message test
git push
shell: bash Note that the fallback email address might not be correct if the user created the email address after July 18, 2017.1 Note further that it is not possible to cancel the workflow, the only way to stop the current workflow and let it run again is via Footnotes |
Bring it home |
Thanks for your assistance but im trying to get it to push when creating a release
|
Sorry that I missed it, you have: on:
release:
types: [published, workflow_dispatch] This actually should be as follows to work as expected since on:
release:
types: [published]
workflow_dispatch: In your case it is not entirely clear where you want to commit and push to, since a release can refer to any commit within the entire history of the repository. I see multiple ways on how to solve this, but it would be important to know what it is you exactly want to achieve. |
So I've tried to find a standardised way to do this but I cannot. Here is a vanilla example of what I'm trying to achieve https://github.com/spec-first/connexion/blob/main/.github/workflows/release.yml#L22 So we create a new release which triggers a new commit with newest version (updating the src code) and then tags it with that version and pushes both. |
I probably have similar problem when using awsebcli to deploy my application to AWS Elastic Beanstalk. It uses current git branch to decide which environment should be deployed (dev branch -> dev environment, master branch -> production environment, etc.) After action/checkout@v2 (I have tried older v2.4.0 and even v3) i have action where i simply install cli and run
And since branch default is not set, because i need to only deploy specific branches to specific environments, nothing is deployed. Last successful action ran 5 days ago. |
* Try committing result * fix indent * fix cmd * try-token * Tryfix * try again * Try again * try docs suggested method * try simpler thing * ah wrong perms at top * try agian * Try actions/checkout#317 * try actions/checkout#719 * Generated protofile changes * Try again * Generated protofile changes * use proper paths filtering * Make it do make proto-all * Rename workflow, add go.sum to diff list --------- Co-authored-by: github-actions <[email protected]> Co-authored-by: devbot-wizard <[email protected]>
* Try committing result * fix indent * fix cmd * try-token * Tryfix * try again * Try again * try docs suggested method * try simpler thing * ah wrong perms at top * try agian * Try actions/checkout#317 * try actions/checkout#719 * Generated protofile changes * Try again * Generated protofile changes * use proper paths filtering * Make it do make proto-all * Rename workflow, add go.sum to diff list --------- Co-authored-by: github-actions <[email protected]> Co-authored-by: devbot-wizard <[email protected]>
I've already read #124
I'm trying to push a commit during release but no success
python-publish.yml
looks likeThe text was updated successfully, but these errors were encountered: