Skip to content

Commit 94a1774

Browse files
authored
Merge pull request #1 from marko-js/add-ci
feat: add CI
2 parents e6d2cb7 + 3ace262 commit 94a1774

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
push:
7+
branches: [main]
8+
9+
concurrency:
10+
group: "${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}"
11+
cancel-in-progress: true
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
if: "${{ github.repository_owner == 'marko-js' && github.event_name == 'push' }}"
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
- name: Setup node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 22
24+
cache: npm
25+
- name: Install dependencies
26+
run: npm ci
27+
- name: Deploy
28+
run: npm run deploy
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
REPO_GITHUB_API_TOKEN: ${{ secrets.REPO_GITHUB_API_TOKEN }}

src/routes/docs/+layout.marko

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ article#${styles.article}
2121
img src=contributor.photo alt=""
2222
-- ${contributor.username}
2323
li
24-
a href=`https://github.com/marko-js/website/blob/master/src/routes/docs/${$global.url.pathname.substring(
24+
a href=`https://github.com/marko-js/website-next/blob/main/docs/${$global.url.pathname.substring(
2525
"/docs/".length,
26-
$global.url.pathname.length - 1,
26+
$global.url.pathname.length,
2727
)}.md`
2828
div
2929
fa-icon=faPlus

src/routes/docs/+middleware.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@ interface GithubProfile {
1111
}
1212

1313
export default ((ctx) => {
14-
const route = ctx.url.pathname.substring(
15-
ctx.url.pathname.indexOf("docs/"),
16-
ctx.url.pathname.length - 1,
17-
);
14+
const route = ctx.url.pathname.substring(ctx.url.pathname.indexOf("docs/"));
1815
const contributors: Record<string, GithubProfile> = {};
1916
ctx.contributors = fetch(
20-
`https://api.github.com/repos/marko-js/website/commits?path=${route}.md`,
17+
`https://api.github.com/repos/marko-js/website-next/commits?path=${route}.md`,
2118
{
2219
method: "GET",
2320
headers: {
24-
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
21+
Authorization: `Bearer ${process.env.REPO_GITHUB_API_TOKEN}`,
2522
Accept: "application/vnd.github.v3+json",
2623
},
2724
},

0 commit comments

Comments
 (0)