forked from asyncapi/studio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6adeb15
commit c066df7
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
.github/actions/get-node-version-from-package-lock/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: 'Specify Node version based on package-lock file version' | ||
outputs: | ||
version: | ||
description: 'Node.js version number to use with actions/setup-node action' | ||
value: ${{ steps.getnode.outputs.version }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get Node version | ||
uses: actions/github-script@v6 | ||
id: getnode | ||
with: | ||
script: | | ||
const { resolve } = require('path'); | ||
const packageLockLocation = './package-lock.json'; | ||
core.info(`Location of the packae-lock verification script is: ${ resolve(packageLockLocation) }`) | ||
const packageLock = require(packageLockLocation); | ||
const packageLockVersion = packageLock.lockfileVersion; | ||
let nodeVersion; | ||
switch (packageLockVersion) { | ||
case 1: | ||
nodeVersion = '14' | ||
break; | ||
case 2: | ||
nodeVersion = '16' | ||
break; | ||
case 3: | ||
nodeVersion = '18' | ||
break; | ||
default: | ||
nodeVersion = '16' | ||
break; | ||
} | ||
core.setOutput('version', nodeVersion); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Composite action that can be used in other actions or workflows. | ||
# It does not run on its own. | ||
# Replacement for LoveToKnow/slackify-markdown-action. | ||
|
||
name: 'Make Markdown Pretty in Slack' | ||
description: Action used in multiple workflows to handle convertion from markdown to slack--specific-text | ||
inputs: | ||
markdown: | ||
description: Markdown content | ||
required: true | ||
outputs: | ||
text: | ||
description: Slack Markdown | ||
value: ${{ steps.slackify.outputs.text }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: 'npm' | ||
cache-dependency-path: '**/package-lock.json' | ||
- name: Install slackify-markdown package | ||
shell: bash | ||
run: npm install [email protected] | ||
- name: Slackify | ||
uses: actions/github-script@v6 | ||
id: slackify | ||
env: | ||
MARKDOWN: ${{ inputs.markdown }} | ||
with: | ||
script: | | ||
const slackifyMarkdown = require('slackify-markdown'); | ||
try { | ||
const md = process.env.MARKDOWN; | ||
const mrkdwn = slackifyMarkdown(md); | ||
core.setOutput('text', mrkdwn); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |