Giter Club home page Giter Club logo

Comments (5)

nicoddemus avatar nicoddemus commented on July 30, 2024 1

Indeed that was the problem, I fixed by adding an extra step that removed the hooks explicitly:

      - name: Remove LFS hook
        # If the LFS related hooks are present, the GitHub Actions updater
        # will fail because Git will complain about git-lfs not being
        # on the $PATH, because indeed is not available in the action's container.
        # https://github.com/saadmk11/github-actions-version-updater/issues/43
        run: |
          rm .git/hooks/post-checkout
          rm .git/hooks/pre-push

I think this can be solved in this repo in two ways:

  1. Install GitLFS in the container: this will probably increase the container size a bit.
  2. Document the workaround.

I will open a PR with 2) as this might help others with the same problem right away. 👍

from github-actions-version-updater.

saadmk11 avatar saadmk11 commented on July 30, 2024

Hi @nicoddemus, Thanks for reporting the issue.

  • Can you share the workflow file for this action?
  • Do you still get this message after disabling Git LFS (This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-checkout'.) ?
  • Viewing the full raw log maybe useful here to understand what's going on.

This is the function that creates a new branch:

def create_new_git_branch(base_branch_name: str, new_branch_name: str) -> None:
"""
Create a new git branch from base branch.
"""
with gha_utils.group(
f"Create New Branch ({base_branch_name} -> {new_branch_name})"
):
run_subprocess_command(["git", "checkout", base_branch_name])
run_subprocess_command(["git", "checkout", "-b", new_branch_name])

from github-actions-version-updater.

nicoddemus avatar nicoddemus commented on July 30, 2024

Thanks for the quick response!

Can you share the workflow file for this action?

name: Update GitHub actions

on:
  schedule:
    # At 08:30 on Monday.
    # https://crontab.guru
    - cron: '30 8 * * 1'
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          token: ${{ secrets.WORKFLOW_SECRET }}

      - name: Run GitHub Actions Version Updater
        uses: saadmk11/[email protected]
        with:
          token: ${{ secrets.WORKFLOW_SECRET }}
          committer_username: 'Bruno Oliveira'
          committer_email: '[email protected]'
          commit_message: 'Update GitHub Actions to their latest versions'
          pull_request_title: 'Pull Request Title'
          update_version_with: 'release-tag'
          release_types: "all"

You will notice that there is no LFS configuration, that's my original attempt. I configured LFS with:

fetch-depth: 0
lfs: false

But this still gives the exact same error.

Do you still get this message after disabling Git LFS

Yes, sorry for not making that clearer.

Viewing the full raw log maybe useful here to understand what's going on.

Here is the relevant part (can't share the full link because it is a private repo):

2022-11-21T12:15:00.4169094Z ##[group]Parse Configuration
2022-11-21T12:15:00.4169358Z Using Configuration:
2022-11-21T12:15:00.4169903Z {'commit_message': '[automated] Update GitHub Actions to their latest versions',
2022-11-21T12:15:00.4170272Z  'extra_workflow_paths': set(),
2022-11-21T12:15:00.4170580Z  'git_committer_email': '[email protected]',
2022-11-21T12:15:00.4170913Z  'git_committer_username': 'Bruno Oliveira',
2022-11-21T12:15:00.4171664Z  'github_token': '***',
2022-11-21T12:15:00.4171924Z  'ignore_actions': set(),
2022-11-21T12:15:00.4172205Z  'pull_request_team_reviewers': set(),
2022-11-21T12:15:00.4172530Z  'pull_request_title': 'Pull Request Title',
2022-11-21T12:15:00.4172823Z  'pull_request_user_reviewers': set(),
2022-11-21T12:15:00.4173146Z  'release_types': ['major', 'minor', 'patch'],
2022-11-21T12:15:00.4173439Z  'skip_pull_request': False,
2022-11-21T12:15:00.4173724Z  'update_version_with': 'release-tag'}
2022-11-21T12:15:00.4174129Z ##[endgroup]
2022-11-21T12:15:00.4174492Z ##[group]Configure Git Author
2022-11-21T12:15:00.4203442Z ##[notice]Setting Git Commit User to 'Bruno Oliveira'.
2022-11-21T12:15:00.4212616Z ##[notice]Setting Git Commit email to '[email protected]'.
2022-11-21T12:15:00.4213184Z 
2022-11-21T12:15:00.4213190Z 
2022-11-21T12:15:00.4213437Z ##[endgroup]
2022-11-21T12:15:00.4213831Z ##[group]Run GitHub Actions Version Updater
2022-11-21T12:15:00.4214348Z ##[group]Checking ".github/workflows/minimal-linux.yml" for updates
2022-11-21T12:15:00.4214664Z Checking "actions/checkout" for updates...
2022-11-21T12:15:00.4214939Z Found new version for "actions/checkout"
2022-11-21T12:15:00.4216021Z Updating "actions/checkout@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4216331Z Checking "actions/cache" for updates...
2022-11-21T12:15:00.4216590Z Found new version for "actions/cache"
2022-11-21T12:15:00.4216877Z Updating "actions/cache@v3" with "actions/[email protected]"...
2022-11-21T12:15:00.4217248Z Checking "actions/setup-python" for updates...
2022-11-21T12:15:00.4217596Z Found new version for "actions/setup-python"
2022-11-21T12:15:00.4218006Z Updating "actions/setup-python@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4218448Z ##[endgroup]
2022-11-21T12:15:00.4218927Z ##[group]Checking ".github/workflows/update-github-actions.yml" for updates
2022-11-21T12:15:00.4219252Z Found new version for "actions/checkout"
2022-11-21T12:15:00.4219551Z Updating "actions/checkout@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4219967Z Checking "saadmk11/github-actions-version-updater" for updates...
2022-11-21T12:15:00.4220411Z No updates found for "saadmk11/github-actions-version-updater"
2022-11-21T12:15:00.4220826Z ##[endgroup]
2022-11-21T12:15:00.4222054Z ##[warning]Workflow file '.github/workflows/minimal_linux.yml' not found
2022-11-21T12:15:00.4222973Z ##[group]Checking ".github/workflows/update-pre-commit.yml" for updates
2022-11-21T12:15:00.4223291Z Found new version for "actions/checkout"
2022-11-21T12:15:00.4223595Z Updating "actions/checkout@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4223997Z Checking "peter-evans/create-pull-request" for updates...
2022-11-21T12:15:00.4224382Z Found new version for "peter-evans/create-pull-request"
2022-11-21T12:15:00.4225067Z Updating "peter-evans/create-pull-request@v3" with "peter-evans/[email protected]"...
2022-11-21T12:15:00.4225486Z Found new version for "actions/setup-python"
2022-11-21T12:15:00.4225889Z Updating "actions/setup-python@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4226325Z ##[endgroup]
2022-11-21T12:15:00.4226733Z ##[group]Checking ".github/workflows/build.yml" for updates
2022-11-21T12:15:00.4227029Z Found new version for "actions/checkout"
2022-11-21T12:15:00.4227322Z Updating "actions/checkout@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4227689Z Checking "actions/upload-artifact" for updates...
2022-11-21T12:15:00.4228049Z Found new version for "actions/upload-artifact"
2022-11-21T12:15:00.4228465Z Updating "actions/upload-artifact@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4228783Z Checking "actions/cache" for updates...
2022-11-21T12:15:00.4229041Z Found new version for "actions/cache"
2022-11-21T12:15:00.4229341Z Updating "actions/cache@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4229684Z Found new version for "actions/setup-python"
2022-11-21T12:15:00.4230080Z Updating "actions/setup-python@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4230732Z ##[endgroup]
2022-11-21T12:15:00.4231513Z ##[warning]Workflow file '.github/workflows/auto-cancellation.yml' not found
2022-11-21T12:15:00.4232369Z ##[group]Checking ".github/workflows/update-dependencies.yml" for updates
2022-11-21T12:15:00.4232685Z Found new version for "actions/checkout"
2022-11-21T12:15:00.4232988Z Updating "actions/checkout@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4233393Z Found new version for "peter-evans/create-pull-request"
2022-11-21T12:15:00.4233868Z Updating "peter-evans/create-pull-request@v3" with "peter-evans/[email protected]"...
2022-11-21T12:15:00.4234276Z Found new version for "actions/setup-python"
2022-11-21T12:15:00.4234675Z Updating "actions/setup-python@v2" with "actions/[email protected]"...
2022-11-21T12:15:00.4235106Z ##[endgroup]
2022-11-21T12:15:00.4235600Z ##[group]Create New Branch (refs/heads/main -> gh-actions-update-1669032900)
2022-11-21T12:15:00.4236735Z ##[error]Note: checking out 'refs/heads/main'.
2022-11-21T12:15:00.4237204Z 
2022-11-21T12:15:00.4237451Z You are in 'detached HEAD' state. You can look around, make experimental
2022-11-21T12:15:00.4237999Z changes and commit them, and you can discard any commits you make in this
2022-11-21T12:15:00.4238359Z state without impacting any branches by performing another checkout.
2022-11-21T12:15:00.4238560Z 
2022-11-21T12:15:00.4238719Z If you want to create a new branch to retain commits you create, you may
2022-11-21T12:15:00.4239132Z do so (now or later) by using -b with the checkout command again. Example:
2022-11-21T12:15:00.4239336Z 
2022-11-21T12:15:00.4239488Z   git checkout -b <new-branch-name>
2022-11-21T12:15:00.4239643Z 
2022-11-21T12:15:00.4239819Z HEAD is now at 3acfbc3 Set explicit permissions in update gh actions workflow
2022-11-21T12:15:00.4240020Z 
2022-11-21T12:15:00.4240446Z This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-checkout'.
2022-11-21T12:15:00.4240759Z 
2022-11-21T12:15:00.4240765Z 
2022-11-21T12:15:00.5729159Z Post job cleanup.
2022-11-21T12:15:00.7028871Z [command]/usr/bin/git version
2022-11-21T12:15:00.7075049Z git version 2.38.1

This is the function that creates a new branch:

Yes I did browse the action code and found that function, thanks.

The same could be accomplished with a single command btw:

     with gha_utils.group( 
         f"Create New Branch ({base_branch_name} -> {new_branch_name})" 
     ): 
         run_subprocess_command(["git", "checkout", "-b", new_branch_name, base_branch_name])         

Any specific reason why this is done currently with two commands? Not that I think it is related with my problem, just curious. 😁

Thanks!

from github-actions-version-updater.

nicoddemus avatar nicoddemus commented on July 30, 2024

Did investigate a bit more, and indeed the problem might be GitLFS:

git-lfs/git-lfs#4346

Seems like this is a problem if GitLFS is not installed in the container running the action, which would explain why this would fail.

Will try to remove the hook manually and see if it works. 👍

from github-actions-version-updater.

nicoddemus avatar nicoddemus commented on July 30, 2024

Opened #44. 👍

from github-actions-version-updater.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.