Manually modify GITHUB_RUN_NUMBER for workflow #26709
Replies: 14 comments 7 replies
-
Thanks for sharing this insight. GitHub actions still has a huge potential to grow and I have no doubts that sooner or later these scenarios will be covered by some action or via GitHub actions directly. I thought also of adopting this early action to my needs. It existed before the official build number and uses git refs/tags to store the build counters. |
Beta Was this translation helpful? Give feedback.
-
It would be very useful if we could run a one-time operation to set the current run number for the repo. I am migrating our CI/CD pipeline from bitrise. Since we published releases using the bitrise build number, it becomes troublesome to go “back in time” and using a build number that was already used. I imagine others will have similar problems as they migrate from another system. |
Beta Was this translation helpful? Give feedback.
-
We are currently migrating from Travis, this feature request would be a wonderful thing 👍 |
Beta Was this translation helpful? Give feedback.
-
This would be an amazing feature to have. On other build systems (e.g. TeamCity) we can edit the “next run number” which lets us do this kind of thing. Having the build number that GH displays in the actions view match up with the build number we put in our binaries would be so handy. |
Beta Was this translation helpful? Give feedback.
-
I just published an action that does what most commenters seem to want. It lets you add a base number to the GITHUB_RUN_NUMBER. I use it to tag docker images and can’t have the number reset. So I just have to update the base number in the workflow when I edit the workflow. |
Beta Was this translation helpful? Give feedback.
-
I was too very surprised that the |
Beta Was this translation helpful? Give feedback.
-
@mscoutermarsh is this issue resolved yet? |
Beta Was this translation helpful? Give feedback.
-
perhaps by adding two numbers? Example
|
Beta Was this translation helpful? Give feedback.
-
Hello! |
Beta Was this translation helpful? Give feedback.
-
We using auto incremented build number on CI for each build. I think its very common approach on many platforms. As well managing |
Beta Was this translation helpful? Give feedback.
-
Would love to see this feature implemented soon. This will help a lot. I can't rename/duplicate workflows every time I mess up with the build. |
Beta Was this translation helpful? Give feedback.
-
Response#1 |
Beta Was this translation helpful? Give feedback.
-
Just faced same issue as other commenters in here. Please add this feature asap 🙏 |
Beta Was this translation helpful? Give feedback.
-
Considering all my findings on GHA over the years, nowadays I would phrase my feature request different. While GITHUB_RUN_NUMBER modifications would maybe solve one problem, they don't solve others. Not sure if its worth opening an on request in favor of this one but just to place it somewhere: The ability to have an custom persistent key-value store as part of GitHub Actions would solve many use-cases. There is currently now way workflows can store custom variables/values in a deterministic and persistent way. Additionally some new expressions to handle arithmetic operations and type conversions would be needed. Assuming that such a feature is available, you could simply create your own personal GITHUB_RUN_NUMBER by storing a custom counter in this key-value store. Theoretically such a store exists with the new "Repository Variables" feature. But you need to use the REST API to get/set them and authenticate with proper permissions. It should be possible to create a custom action incrementing a custom counter as a step in your build scripts. You can prefix it with workflow or job names as desired. Modifying/Resetting values manually can be done via the GitHub UI. If the feature is very important for anyone, you should be able to create such an easily for your repository. e.g. use github-script to get, increment and store a custom counter. You might also make it available under a environment variable or output for further steps to use. https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28 |
Beta Was this translation helpful? Give feedback.
-
The GITHUB_RUN_NUMBER is currently a nice way of having a build number on your builds. I’m using it to build up a semver like
1.2.3-alpha.{number}
. Unfortunately this number resets if you change the workflow name and in some other scenarios.This can lead to an issue if you deploy your package to registries like npmjs.com. It would be great if we can manually set the new value of GITHUB_RUN_NUMBER within the repository. I could bump it again from 1 to the number I had before renaming my workflow file.
Another use case is if I bump my version to 1.2.4 I want to start again with
alpha.1
. Many CI servers expose this build number/counter and it can be reset manually if needed. GitHub actions seems to be missing this feature so far.Is there maybe a workaround for this? I would like to avoid spoiling my Git history with constant version bumps from the CI environment just to update the build version within my package.json.
Beta Was this translation helpful? Give feedback.
All reactions