Skip to content

Commit a210973

Browse files
committed
example and release please
1 parent b6c531a commit a210973

File tree

4 files changed

+48
-6
lines changed

4 files changed

+48
-6
lines changed

actions/with-post-step/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,36 @@
33
Action to set a command as a post step
44

55
Source Code reference: https://github.com/pyTooling/Actions/tree/main/with-post-step
6+
7+
<!-- x-release-please-start-version -->
8+
9+
```yaml
10+
name: CI
11+
on:
12+
pull_request:
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
23+
with:
24+
persist-credentials: false
25+
26+
- name: Run Create GitHub App Token action
27+
id: command
28+
uses: ./actions/create-github-app-token
29+
run: |
30+
echo "running command"
31+
echo "test_output=test_output_content" >> "${GITHUB_OUTPUT}"
32+
33+
- name: Skip invalid instance
34+
uses: ./actions/with-post-step
35+
run: echo ${{ steps.command.outputs.test_output }}
36+
```
37+
38+
<!-- x-release-please-end-version -->

actions/with-post-step/main.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Reference: https://github.com/pyTooling/Actions/blob/main/with-post-step/main.js
2-
3-
const { spawn } = require("child_process");
4-
const { appendFileSync } = require("fs");
5-
const { EOL } = require("os");
2+
import spawn from "child_process";
3+
import { appendFileSync } from "fs";
4+
import EOL from "os";
65

76
function run(cmd) {
87
const subprocess = spawn(cmd, { stdio: "inherit", shell: true });
@@ -13,9 +12,11 @@ function run(cmd) {
1312

1413
const key = process.env.INPUT_KEY.toUpperCase();
1514

16-
if ( process.env[`STATE_${key}`] !== undefined ) { // Are we in the 'post' step?
15+
if (process.env[`STATE_${key}`] !== undefined) {
16+
// Are we in the 'post' step?
1717
run(process.env.INPUT_POST);
18-
} else { // Otherwise, this is the main step
18+
} else {
19+
// Otherwise, this is the main step
1920
appendFileSync(process.env.GITHUB_STATE, `${key}=true${EOL}`);
2021
run(process.env.INPUT_MAIN);
2122
}

eslint.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import eslintPluginJest from "eslint-plugin-jest";
33
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
44
import js from "@eslint/js";
55
import tseslint from "typescript-eslint";
6+
import globals from "globals";
67

78
export default tseslint.config(
89
js.configs.recommended,
@@ -31,6 +32,9 @@ export default tseslint.config(
3132
parserOptions: {
3233
projectService: true,
3334
},
35+
globals: {
36+
...globals.node,
37+
},
3438
},
3539
},
3640
{

release-please-config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@
159159
"package-name": "validate-renovate-config",
160160
"extra-files": ["README.md"],
161161
"initial-version": "0.1.0"
162+
},
163+
"actions/with-post-step": {
164+
"package-name": "with-post-step",
165+
"extra-files": ["README.md"]
162166
}
163167
},
164168
"release-type": "simple",

0 commit comments

Comments
 (0)