Giter Site home page Giter Site logo

cleartax / jira-lint Goto Github PK

View Code? Open in Web Editor NEW
57.0 15.0 58.0 461 KB

A light-weight lint workflow when using GitHub along with JIRA for project management

License: MIT License

TypeScript 90.00% JavaScript 8.91% Shell 1.09%
pr-description jira-issue jira prs workflow labels

jira-lint's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar lwaddicor avatar nasamin avatar nimeshjm avatar rheaditi avatar richardlhao 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

Watchers

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

jira-lint's Issues

Disable posting of gifs in the comments

Hey. One feature which would be really useful is to be able to configure the posting of gifs into the comments section of the github PR.

I've raised a pr #6 for this.

Thanks for the github action, its really good!

Validate issue status

Description

When pushing changes for a jira issue, sometimes engineers push changes for stories that are already closed or not pulled into the active sprint.

Reasons for issue status validation:

  • Just being humans. engineers might have forgotten to put their story in the correct status.
  • Someone else closed your story e.g. your product owner but you aren't aware.
  • Someone pulled the story out of your active backlog/sprint as a result of prioritisation.
  • Process requirements within your organisation to follow certain workflows based on jira issue status.

Proposal

I propose introducing two new inputs into jira-lint.

validate_issue_status
This should enable validation of jira issue status. By default this validation should be off.

allowed_issue_statuses
This should be used in conjunction with validate_issue_status. When validate_issue_status is true, the allowed_issue_Statuses should be uses as a list of acceptable jira issue statuses provided by the consumer of jira-lint. If validation is enabled, jira-lint should compare the current status of the detected issue with the allowed_issue_statuses. If no match is found then jira-lint should fail the status check and put a comment on the PR with what is wrong.

Example comment when status validation fails

๐Ÿ’” The detected issue is not in one of the allowed statuses ๐Ÿ’”

Detected Status Done โŒ
Allowed Statuses In-Progress,In-Review โœ”๏ธ

Please ensure your jira story is in one of the allowed statuses

JIRA Issue key is not extracted correctly from some branch names.

ABI-2999-incorrectly-populated-0-values-invoices

For ABC-1234-test-branch, JIRA key was extracted correctly and was ABC-1234 as expected.
For ABC-1234-test-branch-worda-0-wordb-wordc, the extracted key was POPULATED-0 and not ABC-1234.

Is it because the code expects the JIRA key in the end ? If so can we add a flag if the JIRA key should be expected in the beginning of the branch name ?

##[error]Request failed with status code 403

I am getting the following error
parser: null, maxHeadersCount: null, _redirectable: [Writable], [Symbol(kNeedDrain)]: false, [Symbol(isCorked)]: false, [Symbol(kOutHeaders)]: [Object: null prototype] }, response: { status: 403, statusText: 'Forbidden', headers: [Object], config: [Object], request: [ClientRequest], data: 'Basic auth with password is not allowed on this instance\n' }, isAxiosError: true, toJSON: [Function] } } ##[error]Request failed with status code 403

Resource not accessible by integration

Run cleartax/jira-lint@master
  with:
    github-token: ***
    jira-token: ***
    jira-base-url: https://xxx.atlassian.net
    skip-branches: ^(production-release|master|release\/v\d+)$
    skip-comments: true
    pr-threshold: 1000
    validate_issue_status: false
    allowed_issue_statuses: In Progress
Base branch ->  develop
Head branch ->  feature/DEV-1234[2](https://github.com/xxx/xxx/runs/xxx?check_suite_focus=true#step:2:2)9-xxx
branch 'feature/DEV-1234[3](https://github.com/xxx/xxx/runs/xxx?check_suite_focus=true#step:2:3)32[9](https://github.com/xxx/xxx/runs/xxx?check_suite_focus=true#step:2:9)xxx' does not match ignore pattern provided in 'skip-branches' option: /^(production-release|master|release\/v\d+)$/
JIRA key -> DEV-xxx
Adding lables ->  [ 'Development', 'Task' ]
Error: Resource not accessible by integration

Pull request description is not updated when the pull request body is empty

As a developer, I would like the pull request description to be updated with the details from the JIRA ticket even if the pull request description is empty/null.

For simple changes, the pull request title and/or commit comments are sufficient context for the pull request reviewer. In those cases, a pull request description may not be needed. In those instances, I would still like for the pull request description to be updated with the ticket details.

In this case, the value returned for 'body' is null

{
"body": null
}

the default value of '' is not honored and prBody is set to null below

const {
      body: prBody = '',
    } = pullRequest as PullRequestParams;

Error: Cannot read property 'map' of undefined when branch name follows conventional commit

Here is the stack trace.

Run cleartax/jira-lint@master
  with:
    github-token: ***
    jira-token: ***
    jira-base-url: https://xxx.atlassian.net
    skip-branches: ^(production-release|master|release\/v\d+)$
    skip-comments: true
    pr-threshold: 1000
    validate_issue_status: false
    allowed_issue_statuses: In Progress
Base branch ->  master
Head branch ->  feature/SEAR-XXX-postgres-disk-space-alert
branch 'feature/SEAR-XXX-postgres-disk-space-alert' does not match ignore pattern provided in 'skip-branches' option: /^(production-release|master|release\/v\d+)$/
JIRA key -> SEAR-XXX
{
  error: TypeError: Cannot read property 'map' of undefined
      at /home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:27867
      at Generator.next (<anonymous>)
      at fulfilled (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:26281)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
}
Error: Cannot read property 'map' of undefined

Appreciate your help.

Not being maintained anymore?

Hey there, we were thinking of using this, however we noticed that this particular repo hasn't been updated since Dec 20th, 2020. I see there are quite a few forks and some very recent commits on some of them.

For this capability, is this repo still usable as-is, and are any of the other repos the "go-to" repo now? Are there better GitHub Actions to do this? I'm just trying to understand the lull in maintenance. Thank you.

Do not support project key within number

Do not support project key within number, like "PP2", "P2P" in JIRA.

I create a PR and I meet some problem on PR checking. But the changes are small. I think you could fix it too.

My PR: #9

Getting Unauthorized Error

Hey all!
I'm using that action on my workflow, it already working but I want to change the API_KEY that I'm using.
I'm creating the KEY from the same user that working, encoding it properly echo "[email protected]:uoDllaxhXXXXXX0sf2f9D13" | base64 but I'm getting an Unauthorized Error :
}, response: { status: 401, statusText: 'Unauthorized', headers: [Object], config: [Object], request: [ClientRequest], data: 'Basic authentication with passwords is deprecated. For more information, see: [https://developer.atlassian.com/cloud/confluence/deprecation-notice-basic-auth/\n](https://developer.atlassian.com/cloud/confluence/deprecation-notice-basic-auth//n)' },

Is someone maybe familiar with a solution?

Error: error for dependabots PR's

I suppose that PR's created by dependabot should be skipped by default. But i saw error

  error: Error: Input required and not supplied: jira-token
      at Object.getInput (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:113632)
      at p (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:20233)
      at /home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:21131
      at Generator.next (<anonymous>)
      at /home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:19906
      at new Promise (<anonymous>)
      at n (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:19654)
      at run (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:20939)
      at Object.131 (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:23551)
      at __webpack_require__ (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:154)
}
Error: Input required and not supplied: jira-token

Branch name: dependabot/npm_and_yarn/fortawesome/pro-regular-svg-icons-5.15.3
Jira lint file:

on: [pull_request]

jobs:
  jira-lint:
    runs-on: ubuntu-latest
    steps:
      - uses: cleartax/jira-lint@master
        name: jira-lint
        with:
          github-token: <secret>
          jira-token: <token>
          jira-base-url: <attlasian-base-url>
          skip-branches: '^(master)$'
          skip-comments: false
          pr-threshold: 1000

I see expected message only if i use skip-branches: '^master$|^dependabot.*'.

Regex for jira issue key finding unwanted matches

Because there is no real way to make a distinction between when it should be a jira issue key of just a different string that happens to match the format, I think it's best to enforce the location of the issue of the jira key to be at the start of the PR title and to use the first match instead of the last, of course this is not backwards compatible so we need to bump a major version.

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.