Skip to content

Commit 387eda0

Browse files
authored
Merge pull request #169 from stiwicourage/develop
New release
2 parents cf6ac88 + cfceafc commit 387eda0

123 files changed

Lines changed: 3573 additions & 7243 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Check Coverage
2+
description: Run CodeScene coverage gates against uploaded coverage artifacts.
3+
4+
inputs:
5+
access-token:
6+
description: CodeScene REST API access token.
7+
required: true
8+
project-url:
9+
description: Full CodeScene project API URL, for example https://codescene.io/v2/projects/12345.
10+
required: true
11+
coverage-files:
12+
description: Glob pattern matching coverage reports to check.
13+
required: true
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Download cs-coverage binary
19+
shell: bash
20+
run: |
21+
set -euo pipefail
22+
curl -fsSL -o "$(pwd)/cs-coverage.zip" https://downloads.codescene.io/enterprise/cli/cs-coverage-linux-amd64-latest.zip
23+
unzip -oq "$(pwd)/cs-coverage.zip"
24+
chmod +x "$(pwd)/cs-coverage"
25+
26+
- name: Run CodeScene coverage gate check
27+
shell: bash
28+
env:
29+
CS_PROJECT_URL: ${{ inputs.project-url }}
30+
CS_ACCESS_TOKEN: ${{ inputs.access-token }}
31+
run: |
32+
set -euo pipefail
33+
find "$(pwd)" -name '*.cobertura.xml' -print
34+
"$(pwd)/cs-coverage" check --verbose --coverage-files "${{ inputs.coverage-files }}"
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Create annotated tag
2+
description: Create an annotated git tag for a commit SHA.
3+
4+
inputs:
5+
tag-name:
6+
description: Tag name to create.
7+
required: true
8+
target-sha:
9+
description: Commit SHA that the tag should reference.
10+
required: true
11+
message:
12+
description: Annotated tag message.
13+
required: true
14+
15+
outputs:
16+
tag-object-sha:
17+
description: SHA of the created tag object.
18+
value: ${{ steps.create.outputs.tag-object-sha }}
19+
20+
runs:
21+
using: composite
22+
steps:
23+
- id: create
24+
uses: actions/github-script@v7
25+
env:
26+
TAG_NAME: ${{ inputs.tag-name }}
27+
TARGET_SHA: ${{ inputs.target-sha }}
28+
TAG_MESSAGE: ${{ inputs.message }}
29+
with:
30+
script: |
31+
const owner = context.repo.owner
32+
const repo = context.repo.repo
33+
const tagName = process.env.TAG_NAME
34+
const targetSha = process.env.TARGET_SHA
35+
const message = process.env.TAG_MESSAGE
36+
37+
try {
38+
await github.rest.git.getRef({
39+
owner,
40+
repo,
41+
ref: `tags/${tagName}`
42+
})
43+
44+
core.setFailed(`Tag '${tagName}' already exists.`)
45+
return
46+
} catch (error) {
47+
if (error.status !== 404) {
48+
throw error
49+
}
50+
}
51+
52+
const tagObject = await github.rest.git.createTag({
53+
owner,
54+
repo,
55+
tag: tagName,
56+
message,
57+
object: targetSha,
58+
type: 'commit'
59+
})
60+
61+
await github.rest.git.createRef({
62+
owner,
63+
repo,
64+
ref: `refs/tags/${tagName}`,
65+
sha: tagObject.data.sha
66+
})
67+
68+
core.setOutput('tag-object-sha', tagObject.data.sha)
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Create verified commit
2+
description: Create a GitHub-verified commit from local workspace changes.
3+
4+
inputs:
5+
base-ref:
6+
description: Branch name or refs/heads reference used as the commit parent and base tree.
7+
required: true
8+
commit-message:
9+
description: Commit message for the new commit.
10+
required: true
11+
12+
outputs:
13+
has-changes:
14+
description: Whether there were local changes to commit.
15+
value: ${{ steps.create.outputs.has-changes }}
16+
commit-sha:
17+
description: SHA of the created commit.
18+
value: ${{ steps.create.outputs.commit-sha }}
19+
parent-sha:
20+
description: SHA of the parent commit used for the new commit.
21+
value: ${{ steps.create.outputs.parent-sha }}
22+
23+
runs:
24+
using: composite
25+
steps:
26+
- id: create
27+
uses: actions/github-script@v7
28+
env:
29+
BASE_REF: ${{ inputs.base-ref }}
30+
COMMIT_MESSAGE: ${{ inputs.commit-message }}
31+
with:
32+
script: |
33+
const fs = require('fs')
34+
const { execSync } = require('child_process')
35+
36+
const owner = context.repo.owner
37+
const repo = context.repo.repo
38+
const baseRefInput = process.env.BASE_REF
39+
const baseRef = baseRefInput.replace(/^refs\/heads\//, '')
40+
const commitMessage = process.env.COMMIT_MESSAGE
41+
42+
const statusLines = execSync('git status --porcelain=v1 --untracked-files=all', {
43+
encoding: 'utf-8'
44+
})
45+
.split('\n')
46+
.filter(Boolean)
47+
48+
if (statusLines.length === 0) {
49+
core.info('No changes to commit.')
50+
core.setOutput('has-changes', 'false')
51+
return
52+
}
53+
54+
const baseRefResponse = await github.rest.git.getRef({
55+
owner,
56+
repo,
57+
ref: `heads/${baseRef}`
58+
})
59+
60+
const parentSha = baseRefResponse.data.object.sha
61+
const baseCommit = await github.rest.git.getCommit({
62+
owner,
63+
repo,
64+
commit_sha: parentSha
65+
})
66+
67+
async function createBlobEntry(filePath) {
68+
const content = fs.readFileSync(filePath, 'utf8')
69+
const blob = await github.rest.git.createBlob({
70+
owner,
71+
repo,
72+
content,
73+
encoding: 'utf-8'
74+
})
75+
76+
return {
77+
path: filePath,
78+
mode: '100644',
79+
type: 'blob',
80+
sha: blob.data.sha
81+
}
82+
}
83+
84+
const tree = []
85+
86+
for (const line of statusLines) {
87+
const status = line.slice(0, 2)
88+
const rawPath = line.slice(3)
89+
90+
if (status.includes('R') && rawPath.includes(' -> ')) {
91+
const [oldPath, newPath] = rawPath.split(' -> ')
92+
93+
tree.push({
94+
path: oldPath,
95+
mode: '100644',
96+
type: 'blob',
97+
sha: null
98+
})
99+
100+
tree.push(await createBlobEntry(newPath))
101+
continue
102+
}
103+
104+
if (status.includes('D')) {
105+
tree.push({
106+
path: rawPath,
107+
mode: '100644',
108+
type: 'blob',
109+
sha: null
110+
})
111+
continue
112+
}
113+
114+
tree.push(await createBlobEntry(rawPath))
115+
}
116+
117+
const newTree = await github.rest.git.createTree({
118+
owner,
119+
repo,
120+
base_tree: baseCommit.data.tree.sha,
121+
tree
122+
})
123+
124+
const newCommit = await github.rest.git.createCommit({
125+
owner,
126+
repo,
127+
message: commitMessage,
128+
tree: newTree.data.sha,
129+
parents: [parentSha]
130+
})
131+
132+
core.setOutput('has-changes', 'true')
133+
core.setOutput('commit-sha', newCommit.data.sha)
134+
core.setOutput('parent-sha', parentSha)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Ensure PSResource repository
2+
description: Ensure the local PSResourceGet store exists and the requested repository is registered.
3+
4+
inputs:
5+
repository-name:
6+
description: PSResource repository name to ensure.
7+
required: false
8+
default: PSGallery
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- shell: pwsh
14+
run: |
15+
$repositoryName = '${{ inputs.repository-name }}'
16+
$psResourcePath = Join-Path $HOME '.local/share/PSResourceGet'
17+
New-Item -ItemType Directory -Path $psResourcePath -Force | Out-Null
18+
19+
if (-not (Get-PSResourceRepository -Name $repositoryName -ErrorAction SilentlyContinue)) {
20+
if ($repositoryName -eq 'PSGallery') {
21+
Register-PSResourceRepository -PSGallery
22+
}
23+
else {
24+
throw "PSResource repository '$repositoryName' is not registered."
25+
}
26+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Update git ref
2+
description: Update an existing branch ref to a specific SHA.
3+
4+
inputs:
5+
ref:
6+
description: Full git ref, for example refs/heads/main.
7+
required: true
8+
sha:
9+
description: Commit SHA the ref should point to.
10+
required: true
11+
force:
12+
description: Whether to force-update the ref.
13+
required: false
14+
default: 'false'
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- uses: actions/github-script@v7
20+
env:
21+
TARGET_REF: ${{ inputs.ref }}
22+
TARGET_SHA: ${{ inputs.sha }}
23+
FORCE_UPDATE: ${{ inputs.force }}
24+
with:
25+
script: |
26+
const owner = context.repo.owner
27+
const repo = context.repo.repo
28+
const refInput = process.env.TARGET_REF
29+
const ref = refInput.replace(/^refs\//, '')
30+
const sha = process.env.TARGET_SHA
31+
const force = process.env.FORCE_UPDATE === 'true'
32+
33+
await github.rest.git.updateRef({
34+
owner,
35+
repo,
36+
ref,
37+
sha,
38+
force
39+
})

.github/prompts/markdown.promt.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Markdown Wrapper Enforcer
2+
3+
## Purpose
4+
Force all output to be wrapped in a Markdown code block using the required format:
5+
6+
~~~
7+
<content>
8+
~~~
9+
10+
This is used when content must be copy-paste ready and consistently wrapped.
11+
12+
---
13+
14+
## Instructions
15+
16+
When generating output:
17+
18+
1. ALWAYS wrap the entire response in:
19+
20+
~~~
21+
<content>
22+
~~~
23+
24+
2. The first line MUST be exactly:~~~
25+
3. The last line MUST be exactly:~~~
26+
4. Inside the block:
27+
- Write normal Markdown content
28+
- Use triple backticks for any code examples
29+
- Ensure proper indentation and formatting
30+
5. Do NOT:
31+
- Add text before or after the wrapper
32+
- Break the wrapper format
33+
- Use alternative fencing styles
34+
35+
---
36+
37+
Inner code block rules
38+
39+
When including code inside the Markdown:
40+
41+
- Use triple backticks
42+
- Include language when relevant
43+
44+
Example:
45+
46+
```powershell
47+
PS> Invoke-NovaBuild
48+
```
49+
50+
```zsh
51+
% nova build
52+
```
53+
54+
---
55+
56+
Output rules
57+
58+
- Output ONLY the wrapped Markdown block
59+
- No explanations outside the block
60+
- No missing fences
61+
- No malformed structure
62+
63+
---
64+
65+
Example invocation
66+
67+
Wrap the following content:
68+
69+
* Explain how to run nova build
70+
* Include CLI and PowerShell examples
71+
72+
---
73+
74+
Expected behavior
75+
76+
The output must:
77+
78+
- Start with: ~~~
79+
- End with: ~~~
80+
- Contain valid Markdown inside
81+
- Be ready to copy directly without edits

0 commit comments

Comments
 (0)