Skip to content
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

Unable to push branch #13

Open
bastelfreak opened this issue Jun 22, 2022 · 6 comments
Open

Unable to push branch #13

bastelfreak opened this issue Jun 22, 2022 · 6 comments

Comments

@bastelfreak
Copy link

Hi!
I'm currently trying to implement your workflow in voxpupuli/vox-pupuli-tasks#479

from the workflow config:

  github-action-updater:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        token: ${{ secrets.SAADMK11_GITHUB_ACTIONS_VERSION_UPDATER_VPT }}
    - name: GitHub Actions Version Updater
      uses: saadmk11/github-actions-version-updater@v0.5.6
      with:
        token: ${{ secrets.SAADMK11_GITHUB_ACTIONS_VERSION_UPDATER_VPT }}

This fails with:

Create New Branch
  error: pathspec 'refs/pull/479/merge' did not match any file(s) known to git
  Switched to a new branch 'gh-actions-update-1655896430'
  [gh-actions-update-1655896430 7cbc18e] Update GitHub Action Versions
   3 files changed, 14 insertions(+), 14 deletions(-)
  To https://github.com/voxpupuli/vox-pupuli-tasks
   ! [remote rejected] gh-actions-update-1655896430 -> gh-actions-update-1655896430 (shallow update not allowed)
  error: failed to push some refs to 'https://github.com/voxpupuli/vox-pupuli-tasks'
Create Pull Request
  Warning: Could not create a pull request on voxpupuli/vox-pupuli-tasks, status code: [422]

and a couple of questions:

  • Does the token for actions/checkout@v2 actually needs the workflow scope?
  • The action is marked as successful, even when the push failed. I think that should be changed?
@saadmk11
Copy link
Owner

saadmk11 commented Aug 9, 2022

Hi @bastelfreak, This action should run on a schedule event or a workflow_dispatch event.

Example:

# Controls when the action will run.
on:
  # can be used to run workflow manually
  workflow_dispatch:
  schedule:
    # Automatically run on every Sunday
    - cron:  '0 0 * * 0'

Does the token for actions/checkout@v2 actually needs the workflow scope?

I think the action should work without this.

The action is marked as successful, even when the push failed. I think that should be changed?

I need to update this behavior.

@desecho
Copy link

desecho commented Aug 21, 2022

Does the token for actions/checkout@v2 actually needs the workflow scope?

I think the action should work without this.

If I add it to a repo without this, it fails to push a branch saying that the workflow permission is not there, however after I add it, run the workflow, then it succeeds, then I remove it from the workflow, run it again and it still works. Looks like a bug of some kind. I am not sure what is going on there.

@saadmk11
Copy link
Owner

If I add it to a repo without this, it fails to push a branch saying that the workflow permission is not there, however after I add it, run the workflow, then it succeeds, then I remove it from the workflow, run it again and it still works. Looks like a bug of some kind. I am not sure what is going on there.

Hi @desecho, Thanks for the bug report. 👍 I have not worked on this for sometime. I will check it out and try to reproduce it when I get some time.

@saadmk11 saadmk11 added the bug Something isn't working label Aug 21, 2022
@vladislav-tkach
Copy link

Does the token for actions/checkout@v2 actually needs the workflow scope?

It seems that it does need a workflow-scoped token. Otherwise, I get an error when the version updater action tries to push a new branch. Not sure why is that but I found the solution here: https://github.com/orgs/community/discussions/27072

@saadmk11
Copy link
Owner

The action is marked as successful, even when the push failed. I think that should be changed?

I need to update this behavior.

Fixed in #17

@saadmk11
Copy link
Owner

Does the token for actions/checkout@v2 actually needs the workflow scope?

It seems that it does need a workflow-scoped token. Otherwise, I get an error when the version updater action tries to push a new branch. Not sure why is that but I found the solution here: https://github.com/orgs/community/discussions/27072

GitHub Actions Log when PAT without workflow scope is used:

! [remote rejected] gh-actions-update-1665821908 -> gh-actions-update-1665821908 (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/new.yaml` without `workflow` scope)

Does the token for actions/checkout@v2 actually needs the workflow scope?

I think the action should work without this.

If I add it to a repo without this, it fails to push a branch saying that the workflow permission is not there, however after I add it, run the workflow, then it succeeds, then I remove it from the workflow, run it again and it still works. Looks like a bug of some kind. I am not sure what is going on there.

I can confirm this. Not sure whats going on here. Happens after changing token with workflow scope to token without workflow scope.

@saadmk11 saadmk11 added Needs More Information and removed bug Something isn't working labels Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants