Git Product home page Git Product logo

gitlab-semantic-versioning's People

Contributors

janjagusch-instaffo avatar kayman-mk avatar matheusbrunetti avatar mrooding avatar noinarisak 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

gitlab-semantic-versioning's Issues

no module named semver

Hi, While executing this code by using GitLab Got an error as line 5 in module import semver. ( no module named 'semver')

Extract merge request labels directly from commit

Hi!

I believe I found a way to extract the merge request labels directly from the merge commit.

The idea is that a merge commit always has two parent commits. The first one is the previous commit in the master branch, the second one the the previous commit in the feature branch

Using the python gitlab sdk:

def get_feature_merge_request(project, commit):
    mr_iid = project.commits.get(commit.parent_ids[-1]).merge_requests()[0]["iid"]
    return project.mergerequests.get(mr_iid)

Getting the project and commit object should be straightforward with the environment variables provided by the Gitlab CI.

import os

gl = gitlab.Gitlab('http://10.0.0.1', job_token=os.environ['CI_JOB_TOKEN'])
gl.auth()

project = gl.project.get(os.environ["CI_PROJECT_ID"])
commit = project.commits.get(os.environ["CI_COMMIT_SHA"])

Putting it all together:

>>> get_feature_merge_request(project, commit).labels
["bump-minor"]

I believe this has two advantages:

  • It removes the regex parsing logic from your codebase (critical if they ever change the structure of the squashed commit message)
  • It should also work without squashing the commits

I think this look pretty promising - but maybe I'm missing something? ๐Ÿค”
What do you think? Does anything speak against this approach?

extract_merge_request_id_from_commit only extracts first digit of merge request

The regex in extract_merge_request_id_from_commit() function only captures the first digit of a merge request.

matches = re.search(r'(\S*\/\S*!)(\d)', message.decode("utf-8"), re.M|re.I)

Simply adding + to the (\d) should do the trick as shown below:

matches = re.search(r'(\S*\/\S*!)(\d+)', message.decode("utf-8"), re.M|re.I)

Make labels configurable through env vars

Hi, thanks for starting this project!

I would like to specify custom label names, e.g. "Removal" and "Feature" instead of "bump-major" and "bump-minor". I believe making this configurable through environment variables (with "bump-major" and "bump-minor" as defaults) would really help many people out.

I'd be glad to do a PR on this one. :)

Gitlab login token

Hi Marc,

Firts at all, thank you for this project.

Maybe will be better use a gitlab access token instead of user/password for security resasons.

Thank you

Best regards

Ignore tags when retrieving the latest version

If I have more than one tag on a commit git describe --tags might return the wrong tag. What about adding an environment variable with tag names to be excluded? These names could be passed to git describe with --exclude latest --exclude stable

What do you think?

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.