-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set stable tag #3084
Merged
+97
−0
Merged
Set stable tag #3084
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a81035f
Create setStableTag.js
mcm1957 aa89cbc
Merge branch 'set-stable-tag' of https://github.com/mcm1957/ioBroker.…
mcm1957 3930a01
add workflow set-stable-tag
mcm1957 55beef4
add setTag action
mcm1957 8d52f51
Merge branch 'set-stable-tag' of https://github.com/mcm1957/ioBroker.…
mcm1957 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add setTag action
commit 55beef409899503d93fd78f9a62ec6d4517d5b6d
There are no files selected for viewing
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,33 @@ | ||
name: Manual action | ||
|
||
# configure manual trigger | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
action: | ||
type: choice | ||
description: action to perform | ||
options: | ||
- closeIssue | ||
- reopenIssue | ||
required: true | ||
repository: | ||
type: string | ||
issue: | ||
type: string | ||
|
||
jobs: | ||
manual-action: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- run: npm i | ||
- run: npm run manualAction | ||
env: | ||
OWN_GITHUB_TOKEN: ${{ secrets.OWN_GITHUB_TOKEN }} | ||
ACTION: ${{ github.event.inputs.action }} | ||
REPOSITORY: ${{ github.event.inputs.repository }} | ||
ISSUE: ${{ github.event.inputs.issue }} |
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,63 @@ | ||
'use strict'; | ||
|
||
const execSync = require('child_process').execSync; | ||
|
||
const { | ||
// addComment, | ||
// addLabel, | ||
// getGithub, | ||
getUrl, | ||
// getAllComments, | ||
// deleteComment | ||
} = require('./common'); | ||
|
||
async function getNpmMeta( pAdapter ) { | ||
return await getUrl(`https://registry.npmjs.org/iobroker.${pAdapter}`); | ||
}; | ||
|
||
async function getNpmDisttags(pAdapter) { | ||
const npmMeta = await getNpmMeta( pAdapter ); | ||
return npmMeta['dist-tags']; | ||
}; | ||
|
||
|
||
async function doIt() { | ||
|
||
const npmTags=await getNpmDisttags(`${process.env.INPUT_ADAPTER}`); | ||
const npmRelease = npmTags[`${process.env.INPUT_TAG}`] || '0.0.0'; | ||
const targetRelease = `${process.env.INPUT_RELEASE}`; | ||
|
||
if (targetRelease === npmRelease) { | ||
console.log (`iobroker.${process.env.INPUT_ADAPTER} ${targetRelease} correctly tagged as ${process.env.INPUT_TAG}`) | ||
} else { | ||
if ( npmRelease === '0.0.0' ) { | ||
console.log (`iobroker.${process.env.INPUT_ADAPTER} does not provide a tag ${process.env.INPUT_TAG}`) | ||
} | ||
console.log (`iobroker.${process.env.INPUT_ADAPTER} ${targetRelease} need to be tagged as ${process.env.INPUT_TAG}`) | ||
console.log( `executing npm --//registry.npmjs.org/:_authToken=*** dist-tag add iobroker.${process.env.INPUT_ADAPTER}@${targetRelease} ${process.env.INPUT_TAG}`); | ||
const cmd = `npm --//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN} dist-tag add iobroker.${process.env.INPUT_ADAPTER}@${targetRelease} ${process.env.INPUT_TAG}`; | ||
try { | ||
const result=execSync( cmd, { encoding: 'utf-8' }); | ||
// console.log(result); | ||
// } catch (_e) { | ||
// // console.log (JSON.stringify(e)); | ||
// } | ||
} | ||
|
||
return 'done'; | ||
} | ||
|
||
// activate for debugging purposes | ||
//process.env.GITHUB_REF = 'refs/pull/2298/merge'; | ||
//process.env.OWN_GITHUB_TOKEN = 'add-token-here'; | ||
//process.env.GITHUB_EVENT_PATH = __dirname + '/../event.json'; | ||
|
||
console.log(`process.env.OWN_GITHUB_TOKEN = ${(process.env.OWN_GITHUB_TOKEN || '').length}`); | ||
console.log(`process.env.NPM_TOKEN = ${(process.env.NPM_TOKEN || '').length}`); | ||
console.log(`process.env.INPUT_TAG = ${(process.env.INPUT_TAG || '')}`); | ||
console.log(`process.env.INPUT_ADAPTER = ${(process.env.INPUT_ADAPTER || '')}`); | ||
console.log(`process.env.INPUT_RELEASE = ${(process.env.INPUT_RELEASE || '')}`); | ||
|
||
doIt() | ||
.then(result => console.log(result)) | ||
.catch(e => console.error(e)); |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / CodeQL
Syntax error Note