spec-up-t 1.1.18 → 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-up-t",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
5
5
  "main": "./index",
6
6
  "repository": {
@@ -1,40 +1,27 @@
1
- name: Set GitHub Pages
1
+ name: Set GitHub Pages and Homepage
2
2
 
3
3
  on:
4
4
  workflow_dispatch:
5
- inputs:
6
- username:
7
- description: 'Your GitHub username (optional, defaults to repository owner)'
8
- required: false
9
5
 
10
6
  jobs:
11
- configure-pages:
7
+ configure-pages-and-homepage:
12
8
  runs-on: ubuntu-latest
13
9
  permissions:
14
10
  contents: read # To check branches
15
11
  pages: write # To configure Pages settings
16
12
  steps:
17
- - name: Determine repository owner
18
- id: get-owner
19
- run: |
20
- OWNER="${{ github.event.inputs.username }}"
21
- if [ -z "$OWNER" ]; then
22
- OWNER="${{ github.repository_owner }}"
23
- fi
24
- echo "OWNER=$OWNER" >> $GITHUB_ENV
25
-
26
13
  - name: Check if gh-pages branch exists
27
14
  id: check-branch
28
15
  run: |
29
16
  RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
30
- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
17
+ -H "Authorization: token ${{ secrets.MY_PAT }}" \
31
18
  -H "Accept: application/vnd.github+json" \
32
- https://api.github.com/repos/${{ env.OWNER }}/${{ github.repository }}/branches/gh-pages)
19
+ https://api.github.com/repos/${{ github.repository }}/branches/gh-pages)
33
20
  if [ "$RESPONSE" -eq 200 ]; then
34
21
  echo "gh-pages branch exists"
35
22
  echo "BRANCH_EXISTS=true" >> $GITHUB_ENV
36
23
  elif [ "$RESPONSE" -eq 404 ]; then
37
- echo "Error: gh-pages branch does not exist in ${{ env.OWNER }}/${{ github.repository }}"
24
+ echo "Error: gh-pages branch does not exist in ${{ github.repository }}"
38
25
  exit 1
39
26
  else
40
27
  echo "Unexpected response code: $RESPONSE"
@@ -43,11 +30,70 @@ jobs:
43
30
 
44
31
  - name: Set GitHub Pages to gh-pages
45
32
  if: env.BRANCH_EXISTS == 'true'
33
+ env:
34
+ PAT: ${{ secrets.MY_PAT }}
46
35
  run: |
47
- curl -L \
36
+ RESPONSE=$(curl -s -L \
48
37
  -X POST \
49
- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
38
+ -H "Authorization: token $PAT" \
39
+ -H "Accept: application/vnd.github+json" \
40
+ https://api.github.com/repos/${{ github.repository }}/pages \
41
+ -d '{"source":{"branch":"gh-pages","path":"/"}}' \
42
+ -w "%{http_code}" -o response.json)
43
+ if [ "$RESPONSE" -eq 201 ] || [ "$RESPONSE" -eq 200 ]; then
44
+ echo "GitHub Pages set to gh-pages branch for ${{ github.repository }}"
45
+ else
46
+ echo "Failed to set GitHub Pages: $RESPONSE"
47
+ cat response.json
48
+ exit 1
49
+ fi
50
+
51
+ - name: Set repository homepage to GitHub Pages URL
52
+ if: env.BRANCH_EXISTS == 'true'
53
+ env:
54
+ PAT: ${{ secrets.MY_PAT }}
55
+ run: |
56
+ # Construct the expected GitHub Pages URL
57
+ REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
58
+ OWNER=$(echo "${{ github.repository }}" | cut -d'/' -f1)
59
+ PAGES_URL="https://${OWNER}.github.io/${REPO_NAME}"
60
+
61
+ # Set the homepage via API
62
+ RESPONSE=$(curl -s -L \
63
+ -X PATCH \
64
+ -H "Authorization: token $PAT" \
65
+ -H "Accept: application/vnd.github+json" \
66
+ https://api.github.com/repos/${{ github.repository }} \
67
+ -d "{\"homepage\":\"${PAGES_URL}\"}" \
68
+ -w "%{http_code}" -o response.json)
69
+
70
+ if [ "$RESPONSE" -eq 200 ]; then
71
+ echo "Repository homepage set to $PAGES_URL for ${{ github.repository }}"
72
+ else
73
+ echo "Failed to set homepage: $RESPONSE"
74
+ cat response.json
75
+ exit 1
76
+ fi
77
+
78
+ - name: Verify homepage matches GitHub Pages URL
79
+ if: env.BRANCH_EXISTS == 'true'
80
+ env:
81
+ PAT: ${{ secrets.MY_PAT }}
82
+ run: |
83
+ # Construct the expected GitHub Pages URL
84
+ REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
85
+ OWNER=$(echo "${{ github.repository }}" | cut -d'/' -f1)
86
+ EXPECTED_URL="https://${OWNER}.github.io/${REPO_NAME}"
87
+
88
+ # Fetch the current homepage from the repo
89
+ CURRENT_HOMEPAGE=$(curl -s -L \
90
+ -H "Authorization: token $PAT" \
50
91
  -H "Accept: application/vnd.github+json" \
51
- https://api.github.com/repos/${{ env.OWNER }}/${{ github.repository }}/pages \
52
- -d '{"source":{"branch":"gh-pages","path":"/"}}'
53
- echo "GitHub Pages set to gh-pages branch for ${{ env.OWNER }}/${{ github.repository }}"
92
+ https://api.github.com/repos/${{ github.repository }} | jq -r '.homepage')
93
+
94
+ if [ "$CURRENT_HOMEPAGE" = "$EXPECTED_URL" ]; then
95
+ echo "Verified: Homepage is set to GitHub Pages URL ($EXPECTED_URL)"
96
+ else
97
+ echo "Error: Homepage ($CURRENT_HOMEPAGE) does not match expected GitHub Pages URL ($EXPECTED_URL)"
98
+ exit 1
99
+ fi