Giter VIP home page Giter VIP logo

andry81-devops / gh-action--git-checkout Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 22 KB

GitHub composite action extension of actions/checkout action. • :page_with_curl: https://github.com/andry81-stats/gh-action--git-checkout--gh-stats :page_with_curl:

Home Page: https://github.com/andry81-devops/github-action-extensions

License: MIT License

action checkout git action-extension git-checkout devops github-action composite-action

gh-action--git-checkout's Introduction

GitHub repo size in bytes lines of code by tokei.rs

GitHub views|any|total GitHub views|any|14d GitHub views|unique per day|total GitHub views|unique per day|14d

GitHub clones|any|total GitHub clones|any|14d GitHub clones|unique per day|total GitHub clones|unique per day|14d

GitHub commits since latest version latest release name GitHub all releases

donate


UserlogChangelogKnown issuescopyright and license Copyright and License

GitHub composite action extension of actions/checkout action.

Tutorial to use with: https://github.com/andry81-devops/github-action-extensions

All tutorials: https://github.com/andry81/index#tutorials

gh-action--git-checkout@master

Features:

  • Checks if a remote repository does exist and has a branch reference to delegate all input into https://github.com/actions/checkout action.

  • Otherwise calls to mkdir + git init instead of call to the actions/checkout action script.

  • Additionally can create working copy subdirectories after the call (mkdir-p extra parameter). Has a difference with a working copy subdirectory creation before the checkout, because the action/checkout action script does cleanup a working copy directory before the checkout.

USAGE

Example snippet:

steps:
  - uses: andry81-devops/gh-action--git-checkout@master
    with:
      repository: ...
      ref:        ...
      path:       ...
      token:      ...

      mkdir-p: >-
        ...

Note See REUSE section for details if you have multiple repositories and want to store all GitHub workflow scripts (.github/workflows/*.yml) in a single repository.

Known Issues

https://github.com/andry81-devops/gh-known-issues#known-issues

Last known issues updates

https://github.com/andry81-devops/gh-known-issues#last-known-issues-updates

Copyright and License

Code and documentation copyright 2022 Andrey Dibrov. Code released under MIT License

gh-action--git-checkout's People

Contributors

andry81 avatar

Watchers

 avatar

gh-action--git-checkout's Issues

Does not work with Github App Token

Hello,

Thank you for your time working on this GHA.
The following line seems to have a problem when used with a Github Application Token.

if git ls-remote -q --exit-code "https://${{ inputs.token }}@github.com/${{ inputs.repository }}" > /dev/null 2>&1; then

When using a token from a Github Application, the if/then will result in false, setting is-repo-exists-and-has-ref to false.

If you use oauth2: or : as the value of inputs.token the check will work as expected in my case, resulting in a true result, setting is-repo-exists-and-has-ref to true.

Unfortunately, checkout/v3 DOES work with a Github Application Token - https://github.com/andry81-devops/gh-action--git-checkout/blob/master/action.yml#L67

So the workaround for the git ls-remote causes a failure with checkout/v3 :(

I do not know if you can use the oauth2: syntax when using a PAT token.

The second possible problem is that the command is not actually checking the ref input.

The command to do so should be git ls-remote -q --exit-code "https://${{ inputs.token }}@github.com/${{ inputs.repository }}" ${{ inputs.ref }} > /dev/null 2>&1

Thank you for your time.

Fails to do checkout on newly created private repo

This is the error:
image
And the error: Process completed with exit code 2.

To add more context, this is what I do before you action is executed:

      - name: Create Repository
        uses: repo-ctrl/create-repo-action@main 
        id: create-repo
        with:
          org-admin-token: '${{secrets.MY_PAT}}'
          repo-name: '${{github.event.inputs.repository_name}}'
      
      - name: Initialize Default Branch
        uses: peterjgrainger/[email protected]
        env:
          GITHUB_TOKEN: '${{secrets.MY_PAT}}'
        with:
          branch: '${{env.DEFAULT_BRANCH}}'

      - uses: andry81-devops/gh-action--git-checkout@master
        with:
          token: '${{secrets.MY_PAT}}'
          repository: '${{github.event.repository.owner.login}}/${{github.event.inputs.repository_name}}'
          ref: '${{env.DEFAULT_BRANCH}}'
          path: '${{env.NEW_REPO_WORK_DIR}}'
          mkdir-p: >-

The repo is created, so the PAT works.
It was working before, since I used it extensively around 6 months ago.
This is not issue of disabled action scripts after period of inactivity, since I have automated action running once a week.

Any ideas?

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.