git-cliff icon indicating copy to clipboard operation
git-cliff copied to clipboard

Naming of GitHub environment variables

Open mateusz-was opened this issue 11 months ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description of the bug

Hi!

This is more 'quality-of-life' enhancement rather than bug, bug I guess it might be helpful...

There are 2 sets naming standards for default GitHub env var values:

  1. GitHub CLI values (prefixed GH_): https://cli.github.com/manual/gh_help_environment
  2. Default env vars set by GitHub in Actions (prefixed GITHUB_): https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables

For default repository value git-cliff uses GITHUB_REPO which doesn't fall inline with any of the above. GH_REPO is used in 1) and GITHUB_REPOSITORY is used in 2)

This can be confusing when you use git-cliff in GitHub Actions for the first time (directly from CLI, without https://github.com/orhun/git-cliff-action).

Steps To Reproduce

  1. Setup GitHub Action pipeline
jobs:
  generate-changelog:
    name: Generate changelog
    runs-on: linux
    steps:
    - name: Checkout
      uses: actions/checkout@v3
      with:
        fetch-depth: 0
        token: '${{ secrets.GIT_CLIFF_PAT }}'
    - name: Install git-cliff
      run: pip install git-cliff
    - name: Render changelog
      run: |
        env | grep GITHUB
        git cliff -v --github-repo=$GITHUB_REPOSITORY --github-token=${{ secrets.GIT_CLIFF_PAT }}` 

Expected behavior

--github-repo=$GITHUB_REPOSITORY should be obsolete and it's value taken from existing GITHUB_REPOSITORY default env variable for better user experience

Screenshots / Logs

No response

Software information

  • Operating system: GitHub Actions
  • Rust version: - (used from PyPI)
  • Project version: 2.7.0

Additional context

This hurt me more, because there was GITHUB_REPO variable set in my company's GHE server. It was pointing to some GitHub Actions configuration repository. I spend an hour to find why the API call were failing 🤷‍♂️

mateusz-was avatar Jan 02 '25 12:01 mateusz-was

Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️

welcome[bot] avatar Jan 02 '25 12:01 welcome[bot]

Hey, thanks for the issue! This definitely makes a lot of sense.

I'm currently investigating to use multiple env values for this: https://github.com/clap-rs/clap/issues/5925 - since switching to another environment variable would be breaking.

orhun avatar Feb 22 '25 21:02 orhun