diff options
author | John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> | 2023-08-02 21:28:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 21:28:13 +0200 |
commit | 7e4cf859f59aaa865985ade13a51a37e3c41e8f6 (patch) | |
tree | 54164e2a04780d227715475a08ad35259a532983 | |
parent | Update example service-account.yml for container group in documentation (#13479) (diff) | |
download | awx-7e4cf859f59aaa865985ade13a51a37e3c41e8f6.tar.xz awx-7e4cf859f59aaa865985ade13a51a37e3c41e8f6.zip |
Added PR check to ensure JIRA links are present (#13839)
-rw-r--r-- | .github/workflows/pr_body_check_jira.yml | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/.github/workflows/pr_body_check_jira.yml b/.github/workflows/pr_body_check_jira.yml new file mode 100644 index 0000000000..0fd20f48d8 --- /dev/null +++ b/.github/workflows/pr_body_check_jira.yml @@ -0,0 +1,35 @@ +--- +name: Check body for reference to jira +on: + pull_request: + branches: + - release_** +jobs: + pr-check: + if: github.repository_owner == 'ansible' && github.repository != 'awx' + name: Scan PR description for JIRA links + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Check for JIRA lines + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: | + echo "$PR_BODY" | grep "JIRA: None" > no_jira + echo "$PR_BODY" | grep "JIRA: https://.*[0-9]+"> jira + exit 0 + # We exit 0 and set the shell to prevent the returns from the greps from failing this step + # See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference + shell: bash {0} + + - name: Check for exactly one item + run: | + if [ $(cat no_jira jira | wc -l) != 1 ] ; then + echo "The PR body must contain exactly one of [ 'JIRA: None' or 'JIRA: <one or more links>' ]" + echo "We counted $(cat no_jira jira | wc -l)" + exit 255; + else + exit 0; + fi |