File tree Expand file tree Collapse file tree 8 files changed +326
-97
lines changed
validate-gai-usage-disclosure Expand file tree Collapse file tree 8 files changed +326
-97
lines changed Original file line number Diff line number Diff line change 1+ name : Setup
2+ description : Setup Node.js and install dependencies
3+
4+ runs :
5+ using : composite
6+ steps :
7+ - name : Setup Node.js
8+ uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
9+ with :
10+ node-version-file : .nvmrc
11+
12+ - name : Restore dependencies
13+ id : yarn-cache
14+ uses : actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
15+ with :
16+ path : |
17+ **/node_modules
18+ .yarn/install-state.gz
19+ key : ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
20+ restore-keys : |
21+ ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
22+ ${{ runner.os }}-yarn-
23+
24+ - name : Install dependencies
25+ if : steps.yarn-cache.outputs.cache-hit != 'true'
26+ run : yarn install --immutable
27+ shell : bash
28+
29+ - name : Cache dependencies
30+ if : steps.yarn-cache.outputs.cache-hit != 'true'
31+ uses : actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
32+ with :
33+ path : |
34+ **/node_modules
35+ .yarn/install-state.gz
36+ key : ${{ steps.yarn-cache.outputs.cache-primary-key }}
Original file line number Diff line number Diff line change 1+ name : " Validate GAI Usage Disclosure"
2+ description : " Ensures the GAI usage was disclosed in the PR description"
3+ author :
" Frantisek Spurny ([email protected] )" 4+
5+ runs :
6+ using : " composite"
7+ steps :
8+ - name : Validate GAI Usage Disclosure
9+ shell : bash
10+ env :
11+ PR_BODY : ${{ github.event.pull_request.body }}
12+ PR_AUTHOR : ${{ github.event.pull_request.user.login }}
13+ run : bash ./.github/actions/validate-gai-usage-disclosure/gai_usage_disclosure_check.sh
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ # List of authors to skip
5+ SKIP_AUTHORS=()
6+
7+ for author in " ${SKIP_AUTHORS[@]} " ; do
8+ if [[ " $PR_AUTHOR " == " $author " ]]; then
9+ echo " PR authored by $PR_AUTHOR , skipping validation."
10+ exit 0
11+ fi
12+ done
13+
14+ # Get PR body from the environment variable set in the workflow
15+ body=" $PR_BODY "
16+
17+ # Extract "Generative AI usage" section
18+ gai_section=$( echo " $body " | awk ' /### Generative AI usage/{flag=1;next}/###/{flag=0}flag' )
19+
20+ # Check if section exists
21+ if [[ -z " $gai_section " ]]; then
22+ echo " Error: Generative AI usage section not found."
23+ exit 1
24+ fi
25+
26+ # Count checked checkboxes
27+ checkboxes=$( echo " $gai_section " | grep -c ' \- \[x\]' )
28+
29+ # Ensure exactly one checkbox is checked
30+ if [[ " $checkboxes " -ne 1 ]]; then
31+ echo " Error: Exactly one checkbox must be checked. Found: $checkboxes ."
32+ exit 1
33+ fi
34+
35+ echo " Generative AI usage disclosure validated successfully."
Original file line number Diff line number Diff line change 1+ name : " Validate PR Title"
2+ description : " Ensures PR titles follow the DEMRUM ticket format"
3+ author :
" Frantisek Spurny ([email protected] )" 4+
5+ runs :
6+ using : " composite"
7+ steps :
8+ - name : Validate PR Title
9+ shell : bash
10+ env :
11+ PR_TITLE : ${{ github.event.pull_request.title }}
12+ PR_AUTHOR : ${{ github.event.pull_request.user.login }}
13+ run : bash ./.github/actions/validate-pr-title/pr_title_check.sh
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ # Debug logging
5+ echo " DEBUG: PR_AUTHOR='$PR_AUTHOR '"
6+ echo " DEBUG: PR_TITLE='$PR_TITLE '"
7+
8+ # List of authors to skip
9+ SKIP_AUTHORS=(" renovate[bot]" " renovate-bot" " dependabot[bot]" )
10+
11+ for author in " ${SKIP_AUTHORS[@]} " ; do
12+ if [[ " $PR_AUTHOR " == " $author " ]]; then
13+ echo " PR authored by $PR_AUTHOR , skipping validation."
14+ exit 0
15+ fi
16+ done
17+
18+ echo " Validating PR title: \" $PR_TITLE \" "
19+
20+ REGEX=' ^\[?(WIP|wip)?\]?\s*(DEMRUM-[0-9]+(,\s?DEMRUM-[0-9]+)*|NO-TICKET):\s.+$'
21+
22+ if [[ " $PR_TITLE " =~ $REGEX ]]; then
23+ echo " ✅ PR title is valid."
24+ else
25+ echo " ❌ PR title is invalid."
26+ echo " "
27+ echo " It must match one of the following formats:"
28+ echo " - DEMRUM-1234: Description"
29+ echo " - DEMRUM-1234, DEMRUM-5678: Description"
30+ echo " - NO-TICKET: Description"
31+ exit 1
32+ fi
Original file line number Diff line number Diff line change 1+ ## Title: [ Short, descriptive title of the PR]
2+
3+ ### Description
4+
5+ [ Bullet list of the changes or enhancements made in this PR.]
6+
7+ [ Provide any necessary context or background information that reviewers should be aware of.]
8+
9+ [ Link to any relevant issues or discussions, if applicable.]
10+
11+ ### Checklist
12+
13+ - [ ] My code follows the project's coding standards.
14+ - [ ] I have run linters/formatters and fixed any issues.
15+ - [ ] There are no merge conflicts.
16+ - [ ] I have performed a self-review of my code.
17+ - [ ] All new and existing tests pass locally.
18+ - [ ] I have added license headers to all files.
19+ - [ ] (If applicable) I have added unit tests for my changes.
20+ - [ ] (If applicable) I have updated the sample app for integration testing.
21+ - [ ] (If applicable) I have updated any relevant documentation.
22+
23+ ### Generative AI usage
24+
25+ - [ ] GAI was not used (or, no additional notation is required)
26+ - [ ] Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
27+ - [ ] GAI was used to create a draft that was subsequently customized or modified
28+ - [ ] Code was generated entirely by GAI
29+
30+ ### How to Test These Changes
31+
32+ [ Provide clear and step-by-step instructions on how reviewers can test the changes you've made.]
33+
34+ ### Future Considerations (Optional)
35+
36+ [ Mention any related upcoming work or considerations for the future.]
You can’t perform that action at this time.
0 commit comments