-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Keeps on failing: fatal: ref HEAD is not a symbolic ref #142
Comments
Hi @qdm12 The issue is that Also,
When using
|
If you want to perform operations on PRs (like correcting typos, formatting) I recommend using a slash command instead of raising another PR to merge into the PR branch. See slash-command-dispatch, and in particular, the ChatOps in Pull Requests demo. |
Thanks so much for the detailed help! I'll stick with the PR approach for now (not too much activity yet / not too much spelling mistakes 😆 ), although your other slash command action is quite exciting as well. Have a great weekend!! |
Hi again, Actually would you know the checkout step so that it would work for PR from forked repositories? In my case it's this log I obtain, using this workflow file - almost the same as yours I think. Thank you so much 👍 |
Apparently, this will work for both local PRs and PRs from forks. I will update the docs to this snippet instead of the one I mentioned above.
|
Actually using this format gives the same error as before 😢 (log), workflow was: name: Misspells
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
misspell:
runs-on: ubuntu-latest
steps:
- name: Checkout on push
if: github.event_name == 'push'
uses: actions/checkout@v2
- name: Checkout on pull_request
if: github.event_name == 'pull_request'
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: reviewdog fixer
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
locale: "US"
- name: sobolevn fixer
uses: sobolevn/misspell-fixer-action@master
- uses: peter-evans/create-pull-request@v2.4.4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Typos fixes'
title: "Typos fixes"
branch: typos
branch-suffix: timestamp |
Sorry @qdm12. I didn't think about this long enough before I replied with this comment. I've tried a lot of this in the past and essentially gave up. Basically, what you are trying to do is not possible with PRs from forks (or the workaround is so complicated it's undesirable). The PR branch lives in the fork. Most likely you have no access to the fork. So when you think about it, what is this workflow trying to do? You want to create a pull request in the fork to update the PR branch? The only way you could do that is if you have write access to the fork, or, you create a fork of the fork and raise a PR back to update it. So one option would be to only run on name: Misspells
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
misspell:
+ # Check if the PR is not from a fork
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout on push
if: github.event_name == 'push'
uses: actions/checkout@v2
- name: Checkout on pull_request
if: github.event_name == 'pull_request'
uses: actions/checkout@v2
with:
- ref: ${{ github.event.pull_request.head.sha }}
+ ref: ${{ github.head_ref }}
- name: reviewdog fixer
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
locale: "US"
- name: sobolevn fixer
uses: sobolevn/misspell-fixer-action@master
- uses: peter-evans/create-pull-request@v2.4.4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Typos fixes'
title: "Typos fixes"
branch: typos
branch-suffix: timestamp As I mentioned previously, if you really want a solution to check/fix both local and fork PRs I suggest to use slash-command-dispatch. |
@qdm12 Hope you managed to find a setup that works well for you. Closing this issue for now. |
I have the following Github workflow
But unfortunately it fails with the logs when a pull request is made:
Full log
Example of PR from typo branch
Any help would be greatly appreciated as I would ideally like to use this action for other workflows as well! 👍
The text was updated successfully, but these errors were encountered: