diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..37eab8f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,23 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..11fc491 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..18df8aa --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,33 @@ +# How to contribute to Shortify Git Revision + +## Did you find a bug + +* **Do not open up a GitHub issue if the bug is a security vulnerability**, and instead to refer to our [security policy][1]. + +* **Ensure the bug was not already reported** by searching on GitHub under [Issues][2]. + +* If you're unable to find an open issue addressing the problem, [open a 'Bug' issue][4]. +Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. + +## Did you write a patch that fixes a bug + +* Open a new GitHub pull request with the patch. + +* Ensure the PR description clearly describes the problem and solution. +Include the relevant issue number if applicable. + +## Do you intend to add a new feature or change an existing one + +* Suggest your change by [opening a 'Feature request' issue][5] + +## Do you have questions about the source code + +* [open an issue][3] with your question. + +Thanks! + +[1]: https://github.com/rlespinasse/shortify-git-revision/security/policy +[2]: https://github.com/rlespinasse/shortify-git-revision/issues +[3]: https://github.com/rlespinasse/shortify-git-revision/issues/new +[4]: https://github.com/rlespinasse/shortify-git-revision/issues/new?assignees=&labels=bug&template=bug_report.md&title= +[5]: https://github.com/rlespinasse/shortify-git-revision/issues/new?assignees=&labels=enhancement&template=feature_request.md&title= \ No newline at end of file diff --git a/README.md b/README.md index dcd2020..c731452 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,22 @@ # Shortify git revision -> Github Action to shortify a git revision +> [!NOTE] +> A GitHub Action that generates shortened Git revision identifiers from full-length commit hashes and exposes them as environment variables. -Produce short revision environment variable based on the input one. +## Features -If a revision is a bad revision, this action will produce an error message and fail depending on `continue-on-error` input (This behavior can be override with `short-on-error` input). -``, and `_SHORT` environment variable will only be available if the revision is not empty and valid. +- Converts full Git revisions into their shortened form +- Validates revision format and handles invalid inputs +- Provides both full and shortened revisions as environment variables +- Configurable error handling for invalid revisions + +## Behavior + +- Creates `` and `_SHORT` environment variables for valid revisions +- Environment variables are only set when the input revision is non-empty and valid +- Handles invalid revisions based on configuration: + - Fails by default (controlled by `continue-on-error` input) + - Can be customized using `short-on-error` input to override default behavior ## Usage @@ -85,8 +96,9 @@ If a revision is a bad revision, this action will produce an error message and f ### `name` -If used with `revision` input, it's the name of the environment variable containing the revision to shortify. -Otherwise, the `name` input will be used (in upper case) to define a environment variable containing the `revision` input value. +When providing a `revision` through the revision input, the action will use this environment variable name to store the shortened hash. + +If no environment variable is specified, the action automatically creates one using the `name` input (converted to uppercase) to store the provided `revision` value. ### `revision` @@ -106,8 +118,10 @@ If the input is set to `true`, this action will short a bad revision The default value is `false`. -> If this input is set to `true`, the input `continue-on-error` input will be ignored. -> If this input is set to `true`, the input `length` input is mandatory. +> [!WARNING] +> +> - If this input is set to `true`, the input `continue-on-error` input will be ignored. +> - If this input is set to `true`, the input `length` input is mandatory. ### `prefix` diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..31837ca --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,22 @@ +# Security Policy + +## Supported Versions and Branches + +| Version | Supported | End of Support | Branch | Specific Tags | +| ------- | ------------------ | -------------- | ------ | ------------- | +| 1.x | :white_check_mark: | | v1.x | v1 | + +A GitHub repository can use one of the available branches as an action inside its workflows. + +### End of Life of a branch + +Since `2024-10-26`, when a new major version is released, + +- The previous one will continue to receive security patches for 3 months, +- After the 3 months, the branch is deleted, and only the tags remain. + +## Reporting a Vulnerability + +In this project, you can report a Vulnerability by creating a [draft security advisory](https://github.com/rlespinasse/shortify-git-revision/security/advisories). + +If the vulnerability is confirmed, a fix will be produced and the advisory will be published.