gitlab-auto-close-issue
This is a simple Python cli script that allows you close issues on GitLab automatically. It is intended to be used during your CI/CD. However you can chose to use it however you wish.
Usage
First you need to create a personal access token, more information here. With the scope api, so it can close the issue for you.
pip install gitlab-auto-close-issue
gitlab_auto_close_issue --help
Usage: gitlab_auto_close_issue [OPTIONS]
GitLab Auto Close Issue
Options:
--private-token TEXT Private GITLAB token, used to authenticate when
calling the auto issue close API. [required]
--project-id INTEGER The project ID on GitLab to create the auto close API for.
[required]
--gitlab-url TEXT The GitLab URL.
[required]
-i, --issue TEXT The Issue ID to close. [required]
-r, --remove-label TEXT The labels to remove from (all) the issue(s) before
closing it.
--help Show this message and exit.
$ gitlab_auto_close_issue --private-token xxx --project-url https://gitlab.com/hmajid2301/test \
--project-id 14416075 --issue 1 --remove-label bug
GitLab CI
Set a secret variable in your GitLab project with your private token. Name it GITLAB_PRIVATE_TOKEN (CI/CD > Environment Variables). This is necessary to close the issue on your behalf. More information click here. This access token is passed to the script with the --private-token argument. An example CI using this can be found here, look for the close:issue job.
Add the following to your .gitlab-ci.yml file:
stages:
- post
close:issue:
image: registry.gitlab.com/gitlab-automation-toolkit/gitlab-auto-close-issue
stage: post
before_script: []
script:
- gitlab_auto_close_issue --issue 1 --remove-label "Doing" --remove-label "To Do"
Predefined Variables
Please note some of the arguments can be filled in using environment variables defined during GitLab CI. For more information click here <https://docs.gitlab.com/ee/ci/variables/predefined_variables.html>_.
If --private-token is not set the script will look for the ENV variable GITLAB_PRIVATE_TOKEN
If --source-branch is not set the script will look for the ENV variable CI_COMMIT_REF_NAME
If --project-id is not set it will look for for the ENV variable CI_PROJECT_ID
If --gitlab-url is not set it will look for for the ENV variable CI_PROJECT_URL
If --user-id is not set it will look for for the ENV variable GITLAB_USER_ID
Setup Development Environment
git clone git@gitlab.com:gitlab-automation-toolkit/gitlab-auto-close-issue.git
cd gitlab-auto-close-issue
pip install tox
make virtualenv
make install-dev
Changelog
You can find the changelog here.
Metadata
Release files for gitlab-auto-close-issue 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gitlab-auto-close-issue-1.0.0.tar.gz | 4.2 kB | Without provenance | Details for gitlab-auto-close-issue-1.0.0.tar.gz |
Release files / gitlab-auto-close-issue-1.0.0.tar.gz
| Download URL | gitlab-auto-close-issue-1.0.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9da21de5ce7ade926db4a7e7236b97c7cf1e2616b6badfd79566f0093f3741b7
|
|
BLAKE2b-256 checksum How to use checksums |
28742b04311bfeb672ba7135784d9351b357836bbd0d9a6c39b84508765568c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9
|
Security for gitlab-auto-close-issue 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.