Skip to content

Commit 4712fbf

Browse files
authored
Update contributer experience (#5)
feat: updated contributer experience
1 parent 2ec2dad commit 4712fbf

5 files changed

Lines changed: 220 additions & 99 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 91 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,94 @@
11
{
2-
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
3-
"features": {
4-
"ghcr.io/devcontainers/features/github-cli:1": {},
5-
"ghcr.io/devcontainers/features/go:1": {
6-
"version": "1.24"
7-
},
8-
"ghcr.io/github/features/goproxy:1": {},
9-
"ghcr.io/github/features/go-linter:2": {},
10-
"ghcr.io/devcontainers/features/sshd:1": {
11-
"version": "latest"
12-
},
13-
"ghcr.io/devcontainers/features/node:1": {
14-
"nodeGypDependencies": true,
15-
"version": "lts",
16-
"nvmVersion": "latest"
17-
},
18-
"ghcr.io/devcontainers/features/hugo:1": {
19-
"extended": true,
20-
"version": "latest"
21-
}
22-
},
23-
"onCreateCommand": ".devcontainer/on-create-command.sh",
24-
"postCreateCommand": "./tools/setup",
25-
"containerEnv": {
26-
"GOPROXY": "https://goproxy.githubapp.com/mod,https://proxy.golang.org/,direct",
27-
"GOPRIVATE": "",
28-
"GONOPROXY": "",
29-
"GONOSUMDB": "github.com/github/*"
30-
},
31-
"customizations": {
32-
"vscode": {
33-
"extensions": [
34-
"golang.go",
35-
// Recommended for Hextra theme
36-
"mhutchie.git-graph",
37-
"esbenp.prettier-vscode",
38-
"tamasfe.even-better-toml",
39-
"budparr.language-hugo-vscode",
2+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
3+
"containerUser": "vscode",
4+
"features": {
5+
"ghcr.io/devcontainers/features/github-cli:1": {},
6+
"ghcr.io/devcontainers/features/go:1": {
7+
"version": "1.24"
8+
},
9+
"ghcr.io/github/features/goproxy:1": {},
10+
"ghcr.io/github/features/go-linter:2": {},
11+
"ghcr.io/devcontainers/features/sshd:1": {
12+
"version": "latest"
13+
},
14+
"ghcr.io/devcontainers/features/node:1": {
15+
"nodeGypDependencies": true,
16+
"version": "lts",
17+
"nvmVersion": "latest"
18+
},
19+
"ghcr.io/devcontainers/features/hugo:1": {
20+
"extended": true,
21+
"version": "latest"
22+
}
23+
},
24+
"onCreateCommand": ".devcontainer/on-create-command.sh",
25+
"postCreateCommand": "./tools/setup",
26+
"containerEnv": {
27+
"GOPROXY": "https://goproxy.githubapp.com/mod,https://proxy.golang.org/,direct",
28+
"GOPRIVATE": "",
29+
"GONOPROXY": "",
30+
"GONOSUMDB": "github.com/github/*"
31+
},
32+
"customizations": {
33+
"vscode": {
34+
"extensions": [
35+
"golang.go",
36+
// Recommended for Hextra theme
37+
"mhutchie.git-graph",
38+
"prettier.prettier-vscode",
39+
"tamasfe.even-better-toml",
40+
"budparr.language-hugo-vscode",
4041

41-
// Recommended extensions from https://gohugo.io/tools/editors/#visual-studio-code
42-
// Front Matter CMS: https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter
43-
"eliostruyf.vscode-front-matter",
44-
45-
// Hugo Helper: https://marketplace.visualstudio.com/items?itemName=rusnasonov.vscode-hugo
46-
"rusnasonov.vscode-hugo",
47-
48-
// Hugo Language and Syntax Support: https://marketplace.visualstudio.com/items?itemName=budparr.language-hugo-vscode
49-
"budparr.language-hugo-vscode",
50-
51-
// Hugo Themer: https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-hugo-themer
52-
"eliostruyf.vscode-hugo-themer",
53-
54-
// hugofy: https://marketplace.visualstudio.com/items?itemName=akmittal.hugofy
55-
"akmittal.hugofy",
56-
57-
// Hugo Shortcode Syntax Highlighting: https://marketplace.visualstudio.com/items?itemName=kaellarkin.hugo-shortcode-syntax
58-
"kaellarkin.hugo-shortcode-syntax"
59-
],
60-
"settings": {
61-
"go.lintFlags": [
62-
"--config=/workspaces/.golangci.toml",
63-
"--whole-files",
64-
"--new-from-rev=origin/main"
65-
]
66-
}
67-
},
68-
"codespaces": {
69-
"repositories": {
70-
"github/go-linter": {
71-
"permissions": {
72-
"contents": "read",
73-
"packages": "read"
74-
}
75-
},
76-
"github/features": {
77-
"permissions": {
78-
"contents": "read",
79-
"packages": "read"
80-
}
81-
},
82-
"github/*": {
83-
"permissions": {
84-
"contents": "read",
85-
"packages": "read"
86-
}
87-
}
88-
}
89-
}
90-
},
91-
"forwardPorts": [1313],
92-
"portsAttributes": {
93-
"8080": {
94-
"label": "dev-server"
95-
}
96-
}
42+
// Recommended extensions from https://gohugo.io/tools/editors/#visual-studio-code
43+
"eliostruyf.vscode-front-matter",
44+
"rusnasonov.vscode-hugo",
45+
"budparr.language-hugo-vscode",
46+
"eliostruyf.vscode-hugo-themer",
47+
"akmittal.hugofy",
48+
"kaellarkin.hugo-shortcode-syntax"
49+
],
50+
"settings": {
51+
"go.lintFlags": [
52+
"--config=/workspaces/.golangci.toml",
53+
"--whole-files",
54+
"--new-from-rev=origin/main"
55+
],
56+
"editor.defaultFormatter": "prettier.prettier-vscode",
57+
"editor.tabSize": 2,
58+
"editor.insertSpaces": true,
59+
"editor.detectIndentation": false,
60+
"prettier.requireConfig": true,
61+
"files.insertFinalNewline": true,
62+
"files.trimTrailingWhitespace": true
63+
}
64+
},
65+
"codespaces": {
66+
"repositories": {
67+
"github/go-linter": {
68+
"permissions": {
69+
"contents": "read",
70+
"packages": "read"
71+
}
72+
},
73+
"github/features": {
74+
"permissions": {
75+
"contents": "read",
76+
"packages": "read"
77+
}
78+
},
79+
"github/*": {
80+
"permissions": {
81+
"contents": "read",
82+
"packages": "read"
83+
}
84+
}
85+
}
86+
}
87+
},
88+
"forwardPorts": [1313],
89+
"portsAttributes": {
90+
"8080": {
91+
"label": "dev-server"
92+
}
93+
}
9794
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ updates:
33
- package-ecosystem: "github-actions"
44
directory: "/"
55
schedule:
6-
interval: "weekly"
6+
interval: "daily"
77
labels:
88
- "CI/CD"
99
- "dependabot"
@@ -16,7 +16,7 @@ updates:
1616
- package-ecosystem: "npm"
1717
directory: "/"
1818
schedule:
19-
interval: "weekly"
19+
interval: "daily"
2020
groups:
2121
npm-deps:
2222
patterns:

.github/workflows/pr-check.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ jobs:
2828
with:
2929
fetch-depth: 0
3030

31+
- uses: actions/setup-node@v6
32+
with:
33+
node-version: lts/*
34+
35+
- name: Install dependencies
36+
run: npm ci -o
37+
3138
- uses: super-linter/super-linter/slim@502f4fe48a81a392756e173e39a861f8c8efe056 # v8.3.0
3239
env:
3340
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -84,7 +91,7 @@ jobs:
8491
# Note: The -o flag is required to install optional
8592
# dependencies that include pre-built binaries for tailwindcss
8693
# when running in a CI environment.
87-
#
94+
#
8895
# See: https://github.com/tailwindlabs/tailwindcss/issues/15806
8996
9097
npm ci -o
@@ -124,8 +131,8 @@ jobs:
124131
- name: Upload Pages artifact
125132
uses: actions/upload-pages-artifact@v4
126133
with:
127-
path: "./${{ env.SITE_DIR }}"
128-
retention-days: "7"
134+
path: './${{ env.SITE_DIR }}'
135+
retention-days: '7'
129136

130137
- name: Deploy site to GitHub Pages
131138
id: deployment

.github/workflows/pr-labels.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# PR Labeling Workflow
2+
#
3+
# Purpose: Automatically applies and removes labels on pull requests based on their status
4+
# to improve visibility and workflow management.
5+
#
6+
# Triggers:
7+
# - Pull request converted to draft
8+
# - Pull request marked as ready for review
9+
# - Pull request opened
10+
# - Pull request reopened
11+
# - Pull request closed
12+
#
13+
# How it works:
14+
# - Uses GitHub CLI to modify PR labels based on the event action.
15+
# - Continues execution even if label operations fail (uses `|| true`).
16+
#
17+
# Permissions:
18+
# - pull-requests: write (required to add/remove labels)
19+
20+
name: Label PR
21+
on:
22+
pull_request:
23+
types:
24+
- converted_to_draft
25+
- ready_for_review
26+
- opened
27+
- reopened
28+
- closed
29+
30+
permissions:
31+
pull-requests: write
32+
33+
env:
34+
DRAFT_LABEL: "draft"
35+
READY_LABEL: "ready for review"
36+
37+
jobs:
38+
pr-in-draft-label:
39+
if: github.event.action == 'converted_to_draft'
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Add/Remove PR labels based on event type
43+
shell: bash
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
PR_NUMBER: ${{ github.event.pull_request.number }}
47+
REPO: ${{ github.repository }}
48+
EVENT_ACTION: ${{ github.event.action }}
49+
ADD_LABEL: ${{ env.DRAFT_LABEL }}
50+
REMOVE_LABEL: ${{ env.READY_LABEL }}
51+
run: &update_run |
52+
gh pr edit "$PR_NUMBER" --repo "$REPO" --add-label "$ADD_LABEL" || true
53+
gh pr edit "$PR_NUMBER" --repo "$REPO" --remove-label "$REMOVE_LABEL" || true
54+
echo "Labels updated based on event action: $EVENT_ACTION for PR #$PR_NUMBER" >> "$GITHUB_STEP_SUMMARY"
55+
56+
pr-ready-review-label:
57+
if: github.event.action == 'ready_for_review'
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Add/Remove PR labels based on event type
61+
shell: bash
62+
env:
63+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
PR_NUMBER: ${{ github.event.pull_request.number }}
65+
REPO: ${{ github.repository }}
66+
EVENT_ACTION: ${{ github.event.action }}
67+
ADD_LABEL: ${{ env.READY_LABEL }}
68+
REMOVE_LABEL: ${{ env.DRAFT_LABEL }}
69+
run: *update_run
70+
71+
open-pr-label:
72+
if: github.event.action == 'opened' || github.event.action == 'reopened'
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Set labels based on draft status
76+
shell: bash
77+
run: |
78+
if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then
79+
echo "ADD_LABEL_VALUE=${{ env.DRAFT_LABEL }}" >> $GITHUB_ENV
80+
echo "REMOVE_LABEL_VALUE=${{ env.READY_LABEL }}" >> $GITHUB_ENV
81+
else
82+
echo "ADD_LABEL_VALUE=${{ env.READY_LABEL }}" >> $GITHUB_ENV
83+
echo "REMOVE_LABEL_VALUE=${{ env.DRAFT_LABEL }}" >> $GITHUB_ENV
84+
fi
85+
86+
- name: Add/Remove PR labels based on event type
87+
shell: bash
88+
env:
89+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
PR_NUMBER: ${{ github.event.pull_request.number }}
91+
REPO: ${{ github.repository }}
92+
EVENT_ACTION: ${{ github.event.action }}
93+
ADD_LABEL: ${{ env.ADD_LABEL_VALUE }}
94+
REMOVE_LABEL: ${{ env.REMOVE_LABEL_VALUE }}
95+
run: *update_run
96+
97+
close-remove-labels:
98+
if: github.event.action == 'closed'
99+
runs-on: ubuntu-latest
100+
steps:
101+
- name: Add/Remove PR labels based on event type
102+
shell: bash
103+
env:
104+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
PR_NUMBER: ${{ github.event.pull_request.number }}
106+
REPO: ${{ github.repository }}
107+
EVENT_ACTION: ${{ github.event.action }}
108+
run: |
109+
gh pr edit "$PR_NUMBER" --repo "$REPO" --remove-label "${{ env.DRAFT_LABEL }}" || true
110+
gh pr edit "$PR_NUMBER" --repo "$REPO" --remove-label "${{ env.READY_LABEL }}" || true
111+
echo "Removed labels based on event action: $EVENT_ACTION for PR #$PR_NUMBER" >> "$GITHUB_STEP_SUMMARY"

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ Run only functional tests:
124124
tools/test --functional
125125
```
126126

127+
Run linter:
128+
129+
```bash
130+
tools/lint
131+
```
132+
127133
Review test output for errors and address any failures before submitting changes.
128134

129135
For more detailed development instructions, including GitHub Codespaces setup, see the [Contributing Guide](CONTRIBUTING.md).

0 commit comments

Comments
 (0)