Skip to content

Commit 6d94924

Browse files
Merge pull request #24 from DSACMS/sachin/complianceWorkflows
added compliance workflows
2 parents fe7ee2b + 275b6e3 commit 6d94924

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: "Repository Hygiene Check"
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
workflow_dispatch:
7+
8+
jobs:
9+
check-first-run:
10+
name: Check For First Run
11+
runs-on: ubuntu-latest
12+
outputs:
13+
should_run: ${{ steps.check.outputs.should_run }}
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- id: check
20+
run: |
21+
# If manually triggered, always run
22+
23+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
24+
echo "should_run=true" >> $GITHUB_OUTPUT
25+
exit 0
26+
27+
fi
28+
29+
# Check if initialization label exists
30+
31+
has_label=$(gh label list --json name | jq '.[] | select(.name=="repolinter-initialized")')
32+
33+
if [[ -z "$has_label" ]]; then
34+
# First time - create label and allow run
35+
gh label create repolinter-initialized --description "Marks repo as having run initial repolinter check"
36+
echo "should_run=true" >> $GITHUB_OUTPUT
37+
else
38+
echo "should_run=false" >> $GITHUB_OUTPUT
39+
40+
fi
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
44+
resolve-repolinter-json:
45+
name: Get Repolinter Config
46+
needs: check-first-run
47+
if: needs.check-first-run.outputs.should_run == 'true'
48+
uses: DSACMS/repo-scaffolder/.github/workflows/extendJSONFile.yml@main
49+
with:
50+
url_to_json: 'https://raw.githubusercontent.com/DSACMS/repo-scaffolder/main/tier3/%7B%7Bcookiecutter.project_slug%7D%7D/repolinter.json'
51+
52+
repolinter-checks:
53+
name: Tier 3 Checks
54+
needs: [check-first-run, resolve-repolinter-json]
55+
if: needs.check-first-run.outputs.should_run == 'true'
56+
runs-on: ubuntu-latest
57+
permissions:
58+
contents: write
59+
pull-requests: write
60+
env:
61+
RAW_JSON: ${{ needs.resolve-repolinter-json.outputs.raw-json }}
62+
steps:
63+
- uses: actions/checkout@v4
64+
- run: echo $RAW_JSON > repolinter.json
65+
- uses: DSACMS/repolinter-action@main
66+
with:
67+
config_file: 'repolinter.json'
68+
output_type: 'pull-request'
69+
pull_request_labels: 'repolinter-initialized, cms-oss, cms-gov'
70+
token: ${{ secrets.REPOLINTER_AUTO_TOKEN }}

.github/workflows/updateCodeJSON.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update Code.json
2+
on:
3+
workflow_dispatch:
4+
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
9+
jobs:
10+
update-code-json:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
23+
- name: Setup Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: '1.22'
27+
28+
- name: Install SCC
29+
run: go install github.com/boyter/scc/v3@latest
30+
31+
- name: Update code.json
32+
uses: DSACMS/automated-codejson-generator@main
33+
with:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)