No description
Find a file
John Westcott IV 0106255aa3
Update CONTRIBUTING.md with testing instructions and bump version to v5 (#23)
Added comprehensive testing documentation to CONTRIBUTING.md including tox usage examples and environment options. Updated version reference from v3 to v5 in check_dvcs.py.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-02 15:19:57 -04:00
.github/workflows Make NO_JIRA optional AAP-43965 (#22) 2025-04-23 10:20:54 -04:00
.gitignore Changing to sonar push instead of automatic analysis for code coverage (#7) 2024-11-26 18:12:32 -05:00
action.yml Make NO_JIRA optional AAP-43965 (#22) 2025-04-23 10:20:54 -04:00
check_dvcs.py Update CONTRIBUTING.md with testing instructions and bump version to v5 (#23) 2025-10-02 15:19:57 -04:00
CODE-OF-CONDUCT.md Adding file from project-template 2024-11-21 11:11:58 -05:00
CONTRIBUTING.md Update CONTRIBUTING.md with testing instructions and bump version to v5 (#23) 2025-10-02 15:19:57 -04:00
COPYING Adding file from project-template 2024-11-21 11:11:58 -05:00
DCO Adding file from project-template 2024-11-21 11:11:58 -05:00
LICENSE Adding initial github action 2024-11-25 09:15:13 -05:00
pyproject.toml Changing to sonar push instead of automatic analysis for code coverage (#7) 2024-11-26 18:12:32 -05:00
README.md AAP-35593 - add: unit tests to dcvs checks (#8) 2024-12-05 13:23:08 -03:00
requirements.txt Adding initial github action 2024-11-25 09:15:13 -05:00
requirements_test.txt Adding updates to check_dvcs.py (#9) 2024-12-02 14:57:03 -05:00
SECURITY.md Adding file from project-template 2024-11-21 11:11:58 -05:00
sonar-project.properties Fix sonar, add name for dvcs, remove debug (#20) 2024-12-03 18:46:33 -05:00
test_check_dvcs.py Make NO_JIRA optional AAP-43965 (#22) 2025-04-23 10:20:54 -04:00

Usage

This action validates the following in a PR:

  1. A commit in the pull request has the JIRA issue key in the commit message. Note, that the commit cannot be a merge commit.
  2. The JIRA issue key is at the beginning of the pull request title.
  3. The source branch name also includes the JIRA issue key at the beginning of the branch name.

To use this action create a github workflow like:

on:
  pull_request_target:
    type: opened, synchronize, reopened, edited
jobs:
  dvcs_pr_checker:
    permissions:
      contents: read
      pull-requests: write
    runs-on: ubuntu-latest
    name: Check the PR for DVCS integration
    steps:
      - id: foo
        uses: ansible/dvcs-action@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

Testing locally

In order to test locally we need to set an environment variable called PULL_REQUEST. This can be accomplished by doing a curl command (change and to match what you want to test):

export PULL_REQUEST=$(curl https://api.github.com/repos/ansible/<repo>/pulls/<pull number>)

After that is set you can run the python scrip with the --dry-run command to prevent it from trying to update the PR you are testing:

./check_dvcs.py --dry-run

This will add additional debugging statements as well as not trying to modify the PR.

NOTE: this will use unauthenticated GitHub API requests which are throttled by default. If you hit your limit you will need to wait until your counter resets to test again.