1
+ name : Sync and update Compliance Checks
2
+
3
+ on :
4
+ # Manually trigger the workflow
5
+ workflow_dispatch :
6
+
7
+ permissions :
8
+ # We will create a pull request, so we need write permissions
9
+ pull-requests : write
10
+ # We will be committing to the repository, so we need write permissions
11
+ contents : write
12
+
13
+ jobs :
14
+ sync-and-update :
15
+ runs-on : ubuntu-latest
16
+
17
+ services :
18
+ postgres :
19
+ image : postgres:17.2
20
+ env :
21
+ POSTGRES_DB : dashboard
22
+ POSTGRES_USER : openjs
23
+ POSTGRES_PASSWORD : password
24
+ ports :
25
+ - 5432:5432
26
+ options : >-
27
+ --health-cmd="pg_isready -U openjs"
28
+ --health-interval=10s
29
+ --health-timeout=5s
30
+ --health-retries=5
31
+
32
+ steps :
33
+ - name : Checkout Repository
34
+ uses : actions/checkout@v4
35
+
36
+ - name : Create or Checkout Branch (chore/update-content)
37
+ run : |
38
+ git fetch origin chore/update-content || true
39
+ git checkout chore/update-content || git checkout -b chore/update-content
40
+
41
+ - name : Clone OpenJS Foundation Dashboard
42
+ run : |
43
+ git clone https://github.com/secure-dashboards/openjs-foundation-dashboard.git temp-openjs-dashboard
44
+ cd temp-openjs-dashboard
45
+ npm install
46
+ npm run db:migrate
47
+ psql -U openjs -d dashboard -c "\copy (SELECT json_agg(t) FROM compliance_checks t) TO '../data/checks.json'"
48
+ cd ..
49
+ rm -rf temp-openjs-dashboard
50
+ env :
51
+ PGHOST : localhost
52
+ PGUSER : openjs
53
+ PGPASSWORD : password
54
+ PGDATABASE : dashboard
55
+
56
+ - name : Debug Git Changes
57
+ run : |
58
+ git status
59
+ git diff
60
+
61
+ - name : Commit Updated Checks
62
+ run : |
63
+ git config user.name "GitHub Actions"
64
+ git config user.email "[email protected] "
65
+ git add -A
66
+ git diff --cached --quiet || git commit -m "chore: sync with OpenJS Foundation Dashboard"
67
+
68
+ - name : Install Dependencies and update dynamic content
69
+ run : |
70
+ npm install
71
+ npm run populate-details
72
+ npm run populate-implementations
73
+
74
+ - name : Debug Git Changes
75
+ run : |
76
+ git status
77
+ git diff
78
+
79
+ - name : Commit and Push Changes
80
+ run : |
81
+ git config user.name "GitHub Actions"
82
+ git config user.email "[email protected] "
83
+ git add -A
84
+ git diff --cached --quiet || git commit -m "chore: auto-update content"
85
+ git push origin chore/update-content
86
+ env :
87
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88
+
89
+ - name : Create and Assign Pull Request
90
+ run : |
91
+ gh pr create \
92
+ --base main \
93
+ --head chore/update-content \
94
+ --title "[AUTO] Sync with dashboard database" \
95
+ --body "This PR updates the content based on the current state of the Dashboard." \
96
+ --assignee "${{ github.actor }}
97
+ --reviewer "${{ github.actor }}"
98
+ env :
99
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments