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

Feature Request - Specify commit SHA as input #77

Open
rbiersbach opened this issue Sep 19, 2022 · 4 comments · May be fixed by #101
Open

Feature Request - Specify commit SHA as input #77

rbiersbach opened this issue Sep 19, 2022 · 4 comments · May be fixed by #101
Labels
question Further information is requested

Comments

@rbiersbach
Copy link

Hey guys,
our team is using this action to create a release of our main branch, as soon as the version has been successfully deployed to production.
This would mean e.g. that if deployment is stuck the releases get bigger etc. which is intended.

The problem we are facing is, that the production deployment is triggered from another repository, so when calling your action we always end up with all commits of the latest main branch in the release.
This can cause inconsistency when a new commit comes in while the production deployment is running.

If you could provide an option to optionally override the commit sha here with an input, we could scope the release to our needs:
https://github.com/rymndhng/release-on-push-action/blob/master/src/release_on_push_action/core.clj#L37

Thanks in advance!

@rymndhng
Copy link
Owner

This is undocumented but I think this should be supported by overriding the GITHUB_SHA like so. Can you try something like this?

    steps:
      - uses: rymndhng/release-on-push-action@master
        with:
          bump_version_scheme: minor
        env:
          GITHUB_SHA: {{ PUT_YOUR_SHA_HERE }}

@rymndhng rymndhng added the question Further information is requested label Oct 25, 2022
@tomaaron
Copy link

tomaaron commented Jan 4, 2023

I've tried this without luck!

@bewuethr
Copy link

bewuethr commented Aug 2, 2023

The default variables can't be overwritten. Would it be possible to add an input that defaults to GITHUB_SHA if unset to allow overriding? I'm in a similar situation where the release is created when a CI workflow passes, but if another commit has been merged into the default branch while the first CI workflow is running, the release goes on the most recent, untested commit.

Edit:

I created a small test workflow to make sure GITHUB_SHA can't be overwritten:

name: Test setting GITHUB_SHA
on:
  push:
    branches:
      - main
jobs:
  setsha:
    runs-on: ubuntu-22.04
    steps:
      - env:
          GITHUB_SHA: c3965e3642bc6dafd857715ce4a120a30f1057cd
        run: |
          echo "$GITHUB_SHA"

and, indeed, the environment value is just ignored/overwritten:

Run echo "$GITHUB_SHA"
  echo "$GITHUB_SHA"
  shell: /usr/bin/bash -e {0}
  env:
    GITHUB_SHA: c3965e3642bc6dafd857715ce4a120a30f1057cd
c5db793e0e5c56211aac16268649e0c79ef6402e

Notice how the printed value is different from what I try to set in the environment; it's the SHA of HEAD for the push event.

@bewuethr bewuethr mentioned this issue Aug 3, 2023
2 tasks
@bewuethr
Copy link

bewuethr commented Aug 3, 2023

I have opened a PR that adds the option to override the SHA used at #92 #101, if you're interested 😃

@bewuethr bewuethr linked a pull request Oct 1, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
4 participants