Skip to content

Commit 1cdeabb

Browse files
Merge pull request #1 from meshcloud/feature/meshstack-2025.53
feature/meshstack 2025.53
2 parents 8df9235 + 98d095d commit 1cdeabb

File tree

12 files changed

+840
-5157
lines changed

12 files changed

+840
-5157
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop, 'feature/**' ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [24.x]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run tests
31+
run: npm test
32+
33+
- name: Build action
34+
run: npm run build
35+
36+
- name: Check if dist/ is up to date
37+
run: |
38+
if [ -n "$(git status --porcelain dist/)" ]; then
39+
echo "dist/ directory is not up to date. Please run 'npm run build' and commit the changes."
40+
git status --porcelain dist/
41+
exit 1
42+
fi

.github/workflows/release.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

README.md

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,59 @@
1-
# MeshStack Auth Action
1+
# meshStack Auth Action
22

3-
This action authenticates to meshStack API.
3+
This GitHub Action authenticates to the meshStack API to enable building block automation workflows as well as other API interactions with meshStack.
44

5-
### Overview
5+
## Overview
66

7-
This GitHub Action is designed to authenticate against the Meshfed API. It helps you obtain an access token using client credentials, which can then be used to interact with the Meshfed API securely. This action simplifies the process of obtaining and managing authentication tokens for your workflows.
7+
This action helps you obtain an access token using client credentials, which can then be used to interact with the meshStack API securely. This action simplifies the process of obtaining and managing authentication tokens for your workflows.
88

9-
### API Documentation
9+
## Related Actions
1010

11-
For more information about the Meshfed API, please refer to the [Meshfed API Documentation](https://docs.meshcloud.io/api/index.html).
11+
This action is part of a suite of GitHub Actions for meshStack building block automation:
1212

13+
- **[actions-meshstack-auth](https://github.com/meshcloud/actions-meshstack-auth)** (this action) - Authenticates to the meshStack API
14+
- **[actions-register-source](https://github.com/meshcloud/actions-register-source)** - Registers building block sources and steps with meshStack
15+
- **[actions-send-status](https://github.com/meshcloud/actions-send-status)** - Sends building block step status updates to meshStack
1316

14-
### Inputs
17+
## Documentation
18+
19+
For more information about meshStack building blocks and GitHub Actions integration, refer to:
20+
- [meshStack GitHub Actions Integration](https://docs.meshcloud.io/integrations/github/github-actions/)
21+
- [meshStack API Documentation](https://docs.meshcloud.io/api/index.html)
22+
23+
## Inputs
1524

1625
- `base_url` (required): meshStack API endpoint.
1726
- `client_id` (required): The client ID for the API.
1827
- `key_secret` (required): The key secret for the API.
1928

20-
### Outputs
29+
## Outputs
2130

2231
- `token_file`: Path to the file containing the authentication token
2332

24-
25-
### Example Usage
33+
## Example Usage
2634

2735
```yaml
28-
- name: Setup meshStack bbrun
29-
id: setup-meshstack-auth
30-
uses: meshcloud/[email protected]
31-
with:
32-
base_url: ${{ vars.BUILDINGBLOCK_API_BASE_URL }}
33-
client_id: ${{ vars.BUILDINGBLOCK_API_CLIENT_ID }}
34-
key_secret: ${{ secrets.BUILDINGBLOCK_API_KEY_SECRET }}
36+
name: Deploy Building Block
37+
38+
on:
39+
workflow_dispatch:
40+
inputs:
41+
buildingBlockRunUrl:
42+
description: "URL to fetch the Building Block Run Object from"
43+
required: true
44+
45+
jobs:
46+
deploy:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout Code
50+
uses: actions/checkout@v4
51+
52+
- name: Setup meshStack auth
53+
id: setup-meshstack-auth
54+
uses: meshcloud/actions-meshstack-auth@v2
55+
with:
56+
base_url: ${{ vars.MESHSTACK_BASE_URL }}
57+
client_id: ${{ vars.MESHSTACK_API_CLIENT_ID }}
58+
key_secret: ${{ secrets.MESHSTACK_API_KEY_SECRET }}
3559
```

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: 'Setup Meshstack Authentication'
2-
description: 'Authenticates with Meshstack and sets up environment variables'
1+
name: 'Setup meshStack Authentication'
2+
description: 'Authenticates with meshStack and stores authentication token'
33
inputs:
44
base_url:
5-
description: 'The URL of the Meshstack instance'
5+
description: 'The URL of the meshStack instance'
66
required: true
77
type: string
88
client_id:
@@ -17,7 +17,7 @@ outputs:
1717
token_file:
1818
description: 'Path to the file containing the authentication token'
1919
runs:
20-
using: 'node20'
20+
using: 'node24'
2121
main: 'dist/main/index.js'
2222
post: 'dist/cleanup/index.js'
2323

dist/cleanup/index.js

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25663,42 +25663,31 @@ var __importStar = (this && this.__importStar) || function (mod) {
2566325663
__setModuleDefault(result, mod);
2566425664
return result;
2566525665
};
25666-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
25667-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
25668-
return new (P || (P = Promise))(function (resolve, reject) {
25669-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25670-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
25671-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25672-
step((generator = generator.apply(thisArg, _arguments || [])).next());
25673-
});
25674-
};
2567525666
Object.defineProperty(exports, "__esModule", ({ value: true }));
2567625667
const core = __importStar(__nccwpck_require__(2186));
2567725668
const fs = __importStar(__nccwpck_require__(7147));
2567825669
const path = __importStar(__nccwpck_require__(1017));
2567925670
const os = __importStar(__nccwpck_require__(2037));
25680-
function cleanup() {
25681-
return __awaiter(this, void 0, void 0, function* () {
25682-
try {
25683-
const tempDir = process.env.RUNNER_TEMP || os.tmpdir();
25684-
const tokenFilePath = path.join(tempDir, 'meshstack_token.json');
25685-
if (fs.existsSync(tokenFilePath)) {
25686-
fs.unlinkSync(tokenFilePath);
25687-
core.info(`Deleted token file: ${tokenFilePath}`);
25688-
}
25689-
else {
25690-
core.info(`Token file does not exist: ${tokenFilePath}`);
25691-
}
25671+
async function cleanup() {
25672+
try {
25673+
const tempDir = process.env.RUNNER_TEMP || os.tmpdir();
25674+
const tokenFilePath = path.join(tempDir, 'meshstack_token.json');
25675+
if (fs.existsSync(tokenFilePath)) {
25676+
fs.unlinkSync(tokenFilePath);
25677+
core.info(`Deleted token file: ${tokenFilePath}`);
2569225678
}
25693-
catch (error) {
25694-
if (error instanceof Error) {
25695-
core.setFailed(error.message);
25696-
}
25697-
else {
25698-
core.setFailed('An unknown error occurred during cleanup');
25699-
}
25679+
else {
25680+
core.info(`Token file does not exist: ${tokenFilePath}`);
2570025681
}
25701-
});
25682+
}
25683+
catch (error) {
25684+
if (error instanceof Error) {
25685+
core.setFailed(error.message);
25686+
}
25687+
else {
25688+
core.setFailed('An unknown error occurred during cleanup');
25689+
}
25690+
}
2570225691
}
2570325692
cleanup();
2570425693

0 commit comments

Comments
 (0)