Skip to content

Commit

Permalink
Update Starlight and GitHub Action docs (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanthomasdev authored Apr 17, 2024
1 parent 465ce04 commit ef4b951
Show file tree
Hide file tree
Showing 6 changed files with 1,014 additions and 54 deletions.
2 changes: 2 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import starlight from '@astrojs/starlight';
import { defineConfig } from 'astro/config';
import starlightLinksValidator from 'starlight-links-validator';

const site = 'https://lunaria.dev/';

Expand Down Expand Up @@ -62,6 +63,7 @@ export default defineConfig({
},
],
customCss: ['./src/styles/theme.css', './src/styles/landing.css'],
plugins: [starlightLinksValidator()],
}),
],
});
7 changes: 4 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.15.0",
"astro": "^4.0.3",
"sharp": "^0.32.5"
"@astrojs/starlight": "^0.21.5",
"astro": "^4.6.2",
"sharp": "^0.32.5",
"starlight-links-validator": "^0.8.0"
}
}
2 changes: 1 addition & 1 deletion docs/src/content/docs/manual-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The following example sets up Lunaria to track Markdown/MDX content for both Eng
}
```

Learn more about all the available options in the [Configuration Reference guide](/configuration-reference/).
Learn more about all the available options in the [Configuration Reference guide](/reference/configuration/).

:::tip
Visit the [Lunaria repository's examples directory](https://github.com/yanthomasdev/lunaria/tree/main/examples/) to see configuration examples for different frameworks and projects.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Set the default locale of your project, where the source content is from.

**Type: `{ label: string; lang: string }[]`**

Set all the locales for localization of your project. Its entries follow the same signature as [defaultLocale](#defaultLocale).
Set all the locales for localization of your project. Its entries follow the same signature as [defaultLocale](#defaultlocale-required).

```json
{
Expand Down
34 changes: 24 additions & 10 deletions docs/src/content/docs/tools/github-action.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ title: GitHub Action
description: Add Lunaria insights into your GitHub pull requests.
---

import { Tabs, TabItem } from '@astrojs/starlight/components';
import { Tabs, TabItem, Steps } from '@astrojs/starlight/components';

You can get helpful insights on how pull requests are going to affect the resulting localization status after merging through the Lunaria GitHub Action.
The Lunaria GitHub Action comments on pull requests with an overview of how the changes made will affect the localization status generated after merging, including insights on possible issues and how Lunaria works.

## Prerequisites

Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache: npm

- run: npm install

Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
cache: pnpm

- name: Setup PNPM
uses: pnpm/action-setup@v3
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache: yarn

- run: yarn install

Expand All @@ -153,15 +153,20 @@ jobs:
If everything was set up properly, the Action will now comment on every new, or updated pull request that has files tracked by Lunaria (those who do not, won't receive a comment).
### Run on a private repository
:::tip[Changing the comment's author]
Normally, comments made by the Action will be authored by `github-actions[bot]`. You can change this behavior by [defining a different `token` input](http://localhost:4321/tools/github-action/#inputs) in your workflow file, so that the comments will be authored by the user or bot whose the token comes from.
:::

By default, the Action won't run on a private repository for a lack of permissions. To fix this, you will need to make a few changes:
### Additional steps for private repositories

By default, the Action won't run on a private repository for a lack of permissions. To fix this, you will need to follow a few additional steps:

<Steps>
1. Create a new [personal access token (PAT) on GitHub](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic) and [add it to your repository's Action secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository).

2. Update the following steps on your workflow at `.github/workflows/lunaria.yml`, with the name of the repository secret you created:
2. Add the `token` input to both the Checkout and Lunaria steps of your workflow file at `.github/workflows/lunaria.yml` with the corresponding secret name you added earlier:

```yml ins={7}
```yml ins={7} mark="PAT"
- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -171,15 +176,24 @@ By default, the Action won't run on a private repository for a lack of permissio
token: ${{ secrets.PAT }}
```

```yml ins={4}
```yml ins={4} mark="PAT"
- name: Generate Lunaria Overview
uses: yanthomasdev/lunaria-action@main
with:
token: ${{ secrets.PAT }}
```

</Steps>

## Reference

### Inputs

- `token` - Optional: a [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#about-personal-access-tokens) to run the Action with.

```yml mark={4}
- name: Generate Lunaria Overview
uses: yanthomasdev/lunaria-action@main
with:
token: ${{ secrets.PAT }}
```
Loading

0 comments on commit ef4b951

Please sign in to comment.