Skip to content

Commit 4ddf554

Browse files
committed
feat: initial version
1 parent c898ec7 commit 4ddf554

39 files changed

Lines changed: 60900 additions & 1055 deletions

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "GitHub Actions (TypeScript)",
2+
"name": "Obsidian Workflows",
33
"image": "mcr.microsoft.com/devcontainers/typescript-node:20",
44
"postCreateCommand": "npm install",
55
"customizations": {

.env.example

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,21 @@
11
# dotenv-linter:off IncorrectDelimiter
22

3-
# Do not commit your actual .env file to Git! This may contain secrets or other
4-
# private information.
3+
# Do not commit your actual .env file to Git!
54

6-
# Enable/disable step debug logging (default: `false`). For local debugging, it
7-
# may be useful to set it to `true`.
5+
# Enable/disable step debug logging (default: false).
86
ACTIONS_STEP_DEBUG=true
97

10-
# GitHub Actions inputs should follow `INPUT_<name>` format (case-sensitive).
11-
# Hyphens should not be converted to underscores!
12-
INPUT_MILLISECONDS=2400
8+
# Action inputs (INPUT_<name> format, case-sensitive).
9+
INPUT_TYPE=auto
10+
INPUT_MODE=pr
11+
INPUT_BUILD=
12+
INPUT_LINT=true
13+
INPUT_SCANNER-LINT=false
14+
INPUT_NODE-VERSION=24
1315

14-
# GitHub Actions default environment variables. These are set for every run of a
15-
# workflow and can be used in your actions. Setting the value here will override
16-
# any value set by the local-action tool.
17-
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
16+
# Simulated workspace path for local testing.
17+
# GITHUB_WORKSPACE=/path/to/your/obsidian-plugin-or-theme
1818

19-
# CI="true"
20-
# GITHUB_ACTION=""
21-
# GITHUB_ACTION_PATH=""
22-
# GITHUB_ACTION_REPOSITORY=""
23-
# GITHUB_ACTIONS=""
24-
# GITHUB_ACTOR=""
25-
# GITHUB_ACTOR_ID=""
26-
# GITHUB_API_URL=""
27-
# GITHUB_BASE_REF=""
28-
# GITHUB_ENV=""
29-
# GITHUB_EVENT_NAME=""
30-
# GITHUB_EVENT_PATH=""
31-
# GITHUB_GRAPHQL_URL=""
32-
# GITHUB_HEAD_REF=""
33-
# GITHUB_JOB=""
34-
# GITHUB_OUTPUT=""
35-
# GITHUB_PATH=""
36-
# GITHUB_REF=""
37-
# GITHUB_REF_NAME=""
38-
# GITHUB_REF_PROTECTED=""
39-
# GITHUB_REF_TYPE=""
40-
# GITHUB_REPOSITORY=""
41-
# GITHUB_REPOSITORY_ID=""
42-
# GITHUB_REPOSITORY_OWNER=""
43-
# GITHUB_REPOSITORY_OWNER_ID=""
44-
# GITHUB_RETENTION_DAYS=""
45-
# GITHUB_RUN_ATTEMPT=""
46-
# GITHUB_RUN_ID=""
47-
# GITHUB_RUN_NUMBER=""
48-
# GITHUB_SERVER_URL=""
49-
# GITHUB_SHA=""
50-
# GITHUB_STEP_SUMMARY=""
51-
# GITHUB_TRIGGERING_ACTOR=""
52-
# GITHUB_WORKFLOW=""
53-
# GITHUB_WORKFLOW_REF=""
54-
# GITHUB_WORKFLOW_SHA=""
55-
# GITHUB_WORKSPACE=""
56-
# RUNNER_ARCH=""
57-
# RUNNER_DEBUG=""
58-
# RUNNER_NAME=""
59-
# RUNNER_OS=""
60-
# RUNNER_TEMP=""
61-
# RUNNER_TOOL_CACHE=""
19+
# GitHub Actions default environment variables.
20+
# GITHUB_REF=refs/tags/1.0.0
21+
# GITHUB_TOKEN=

.github/copilot-instructions.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Copilot Instructions
22

3-
This GitHub Action is written in TypeScript and transpiled to JavaScript. Both
4-
the TypeScript sources and the **generated** JavaScript code are contained in
5-
this repository. The TypeScript sources are contained in the `src` directory and
6-
the JavaScript code is contained in the `dist` directory. A GitHub Actions
7-
workflow checks that the JavaScript code in `dist` is up-to-date. Therefore, you
8-
should not review any changes to the contents of the `dist` folder and it is
9-
expected that the JavaScript code in `dist` closely mirrors the TypeScript code
10-
it is generated from.
3+
This GitHub Action validates, lints, builds, and releases Obsidian plugins and
4+
themes. It is written in TypeScript and transpiled to JavaScript. Both the
5+
TypeScript sources and the **generated** JavaScript code are contained in this
6+
repository. The TypeScript sources are contained in the `src` directory and the
7+
JavaScript code is contained in the `dist` directory. A GitHub Actions workflow
8+
checks that the JavaScript code in `dist` is up-to-date. Therefore, you should
9+
not review any changes to the contents of the `dist` folder and it is expected
10+
that the JavaScript code in `dist` closely mirrors the TypeScript code it is
11+
generated from.
1112

1213
## Repository Structure
1314

@@ -22,6 +23,15 @@ it is generated from.
2223
| `badges/` | Badges for readme |
2324
| `dist/` | Generated JavaScript Code |
2425
| `src/` | TypeScript Source Code |
26+
| `src/types.ts` | Shared types and manifest interfaces |
27+
| `src/detect.ts` | Project type detection (plugin vs theme) |
28+
| `src/manifest.ts` | Manifest and versions.json validation |
29+
| `src/repo-checks.ts` | License and README validation |
30+
| `src/build.ts` | Build step auto-detection and execution |
31+
| `src/lint.ts` | Lint integration (user config and scanner rulesets) |
32+
| `src/release.ts` | Release asset validation, attestation, draft release |
33+
| `src/main.ts` | Action orchestrator |
34+
| `src/index.ts` | Entry point |
2535
| `.env.example` | Environment Variables Example for `@github/local-action` |
2636
| `.licensed.yml` | Licensed Configuration |
2737
| `.markdown-lint.yml` | Markdown Linter Configuration |
@@ -71,15 +81,12 @@ npm run bundle
7181
- Follow standard TypeScript and JavaScript coding conventions and best
7282
practices
7383
- Changes should maintain consistency with existing patterns and style
74-
- Document changes clearly and thoroughly, including updates to existing
75-
comments when appropriate
7684
- Do not include basic, unnecessary comments that simply restate what the code
7785
is doing (focus on explaining _why_, not _what_)
7886
- Use consistent error handling patterns throughout the codebase
7987
- Use TypeScript's type system to ensure type safety and clarity
8088
- Keep functions focused and manageable
8189
- Use descriptive variable and function names that clearly convey their purpose
82-
- Use JSDoc comments to document functions, classes, and complex logic
8390
- After doing any refactoring, ensure to run `npm run test` to ensure that all
8491
tests still pass and coverage requirements are met
8592
- When suggesting code changes, always opt for the most maintainable approach.

.github/workflows/ci.yml

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,66 @@ jobs:
4444
id: npm-ci-test
4545
run: npm run ci-test
4646

47-
test-action:
48-
name: GitHub Actions Test
47+
test-action-plugin:
48+
name: Test Action (Plugin Fixture)
4949
runs-on: ubuntu-latest
5050

5151
steps:
5252
- name: Checkout
5353
id: checkout
5454
uses: actions/checkout@v6
5555

56-
- name: Test Local Action
56+
- name: Copy plugin fixture to workspace root
57+
run: |
58+
cp __fixtures__/sample-plugin/manifest.json .
59+
cp __fixtures__/sample-plugin/versions.json .
60+
cp __fixtures__/sample-plugin/README.md .
61+
cp __fixtures__/sample-plugin/LICENSE .
62+
63+
- name: Test Local Action (plugin)
64+
id: test-action
65+
uses: ./
66+
with:
67+
type: auto
68+
mode: pr
69+
lint: 'false'
70+
build: 'false'
71+
72+
- name: Verify outputs
73+
run: |
74+
echo "Detected type: ${{ steps.test-action.outputs.type }}"
75+
echo "Validation passed: ${{ steps.test-action.outputs.validation-passed }}"
76+
test "${{ steps.test-action.outputs.type }}" = "plugin"
77+
test "${{ steps.test-action.outputs.validation-passed }}" = "true"
78+
79+
test-action-theme:
80+
name: Test Action (Theme Fixture)
81+
runs-on: ubuntu-latest
82+
83+
steps:
84+
- name: Checkout
85+
id: checkout
86+
uses: actions/checkout@v6
87+
88+
- name: Copy theme fixture to workspace root
89+
run: |
90+
cp __fixtures__/sample-theme/manifest.json .
91+
cp __fixtures__/sample-theme/theme.css .
92+
cp __fixtures__/sample-theme/README.md .
93+
cp __fixtures__/sample-theme/LICENSE .
94+
95+
- name: Test Local Action (theme)
5796
id: test-action
5897
uses: ./
5998
with:
60-
milliseconds: 2000
99+
type: auto
100+
mode: pr
101+
lint: 'false'
102+
build: 'false'
61103

62-
- name: Print Output
63-
id: output
64-
run: echo "${{ steps.test-action.outputs.time }}"
104+
- name: Verify outputs
105+
run: |
106+
echo "Detected type: ${{ steps.test-action.outputs.type }}"
107+
echo "Validation passed: ${{ steps.test-action.outputs.validation-passed }}"
108+
test "${{ steps.test-action.outputs.type }}" = "theme"
109+
test "${{ steps.test-action.outputs.validation-passed }}" = "true"

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Obsidian Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
type:
7+
description: 'Project type: plugin, theme, or auto'
8+
type: string
9+
required: false
10+
default: 'auto'
11+
build:
12+
description:
13+
'Explicit build command override. Set to "false" to disable.'
14+
type: string
15+
required: false
16+
default: ''
17+
node-version:
18+
description: 'Node.js version (minimum: 20)'
19+
type: string
20+
required: false
21+
default: '24'
22+
23+
jobs:
24+
release:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: write
28+
id-token: write
29+
attestations: write
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: ${{ inputs.node-version }}
37+
cache: npm
38+
39+
- name: Validate, build, and release
40+
uses: saberzero1/obsidian-workflows@v1
41+
with:
42+
type: ${{ inputs.type }}
43+
mode: release
44+
build: ${{ inputs.build }}
45+
lint: 'true'
46+
scanner-lint: 'true'
47+
node-version: ${{ inputs.node-version }}
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
############################################################################
55

66
# Default owners, unless a later match takes precedence.
7-
* @actions/actions-oss-maintainers
7+
* @saberzero1

0 commit comments

Comments
 (0)