Code Monkey home page Code Monkey logo

build-tag-number's Introduction

Hi, I'm Onyx ๐Ÿ‘‹๐Ÿฝ๐Ÿง‘๐Ÿฝโ€๐Ÿ’ป

I'm a passionate leader, software developer, entrepreneur, and technology evangelist. I lead mobile/connected for WarnerMedia's Sports Technology vertical, helping to shape the quality apps we build for Bleacher Report ( iOS | Android ) & March Madness Live ( iOS | Android ).

Featured in androidweekly.net Issue #499

build-tag-number's People

Contributors

daniel-freese avatar onyxmueller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

build-tag-number's Issues

Failed to create new build-number ref. Status: 403

Just moved our repositories from a personal account to an Organisation. I have been getting the following error:

Run onyxmueller/build-tag-number@v1
with:
token: ***
env:
AZURE_WEBAPP_NAME: XXX-dev
AZURE_WEBAPP_PACKAGE_PATH: XXX\published
CONFIGURATION: Release
DOTNET_CORE_VERSION: 7.0.x
WORKING_DIRECTORY: XXX
DOTNET_ROOT: C:\Program Files\dotnet

Last build nr was 359.
Updating build counter to 360...
Error: Failed to create new build-number ref. Status: 403, err: null, result: {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/git/refs#create-a-reference"}

The action setup is as follows:

- name: Generate Build Number
  id: buildnumber
  uses: onyxmueller/build-tag-number@v1
  with:
    token: ${{ secrets.github_token }}        
- name: Print New Build Number
  run: echo "Build number is ${{steps.buildnumber.outputs.build_number}}"

I do not understand why we are getting the 403 response.....
Do I need to update any permissions now we have moved to Organisation?

Change the Too many refs in repository error to warning

At the action, we have a check for old tags with the same prefix, and if we have more than 5 tags matching the search we exit with an error.

I think that this is overkill and it is unnecessary to fail jobs/build just because of that. It is better to change it to a warning.

Also maybe adding a flag that will clean it automatically.

i am talking about the code at main.js line 98

        const MAX_OLD_NUMBERS = 5; //One or two ref deletes might fail, but if we have lots then there's something wrong!
        if (nrTags.length > MAX_OLD_NUMBERS) {
            fail(`ERROR: Too many ${prefix}build-number- refs in repository, found ${nrTags.length}, expected only 1. Check your tags!`);
        }

Build Number Failure

Hi

My yml file is as follows:

permissions:
  contents: read
  packages: write
  pull-requests: write
  repository-projects: write

    - name: Generate Build Number
      id: buildnumber
      uses: onyxmueller/build-tag-number@v1
      with:
        token: ${{ secrets.github_token }}

However as off today I am getting the following error message and I'm not sure if it is the build-tag-number or github:


##[debug]Evaluating condition for step: 'Generate Build Number'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Generate Build Number
##[debug]Loading inputs
##[debug]Evaluating: secrets.github_token
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'github_token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run onyxmueller/build-tag-number@v1
Last build nr was 506.
Updating build counter to 507...
Error: Failed to create new build-number ref. Status: 403, err: null, result: {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/git/refs#create-a-reference"}
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Generate Build Number

Since I am getting an 403 (and this worked so far) and you have no changes in months I am assuming the issue is possibly the github token generation, but I wanted to hear your opinion too. At the moment I do not see any other similar issues raised. Will investigate further.

Cannot output build number correctly

I used to use the original Action and as of today I had an error about multiple tags being present.

build-and-deploy
ERROR: Too many build-number- refs in repository, found 7, expected only 1. Check your tags!

I could not see 7 references and because we only just started using build numbers I removed ALL build number tags and thought to start from scratch and updated to your current branch. So my jobs at the moment looks like this:

jobs: build-and-deploy: runs-on: windows-latest steps: - uses: actions/checkout@v3 - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: dotnet-version: ${{ env.DOTNET_CORE_VERSION }} - name: Restore run: dotnet restore "${{ env.WORKING_DIRECTORY }}" - name: Read Version File Content id: json_properties uses: ActionsTools/read-json-action@main with: file_path: "./VERSION.json" - name: Version File Content run: echo ${{ steps.json_properties.outputs.version }} - name: Generate Build Number uses: onyxmueller/build-tag-number@v1 with: token: ${{ secrets.github_token }} - name: Print New Build Number run: echo "Build number is ${env:BUILD_NUMBER}" - name: Build run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore -property:Version=${{ steps.json_properties.outputs.version }}.${env:BUILD_NUMBER}

And the debug output is this:
Generate Build Number
Run onyxmueller/build-tag-number@v1
Last build nr was 3.
Updating build counter to 4...
Successfully updated build number to 4
'build_number=4' >> $GITHUB_OUTPUT
Deleting 1 older build counters...
Deleted refs/tags/build-number-3
Print New Build Number
Run echo "Build number is ${env:build_number}"
Build number is

And my build fails as I use the build number and it is not present.
It seems that the number is generated but for some reason it is not stored on the BUILD_NUMBER specified as per your example usage. Also I still see all build tags (build-number-1, build-number-2, build-number-3) on my repo, which I believe is as expected. This was also the behaviour of the original Action.

I am definitely running the action on a windows environment (runs-on: windows-latest), and I did use to always have the Build_Number correctly outputted and and passed onto my build command. The environment has not changed. However I do not get the build number any longer stored in the parameter. The original Action did not have any commits since Nov 2020, so I cannot understand the change in behaviour.

Is there an issue with the Action or has Github changed something?
Thank you

Option to not delete the tags

Hello,

I want to use the existing build-number- tags in Releases, so I don't need to delete them.
Would be this possible?

Thank you :)

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.