mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-28 03:40:03 +00:00
Update script timestamp handling and dev promotion
Some checks are pending
Auto Update .app-files / update-app-files (push) Waiting to run
Create Changelog Pull Request / update-changelog-pull-request (push) Waiting to run
Set state to is_deleted in pocketbase / delete-pocketbase-entry (push) Waiting to run
Update script timestamp on .sh changes / update-script-timestamp (push) Waiting to run
Some checks are pending
Auto Update .app-files / update-app-files (push) Waiting to run
Create Changelog Pull Request / update-changelog-pull-request (push) Waiting to run
Set state to is_deleted in pocketbase / delete-pocketbase-entry (push) Waiting to run
Update script timestamp on .sh changes / update-script-timestamp (push) Waiting to run
Compute today's date once and use a consolidated patchBody for PATCH requests (including last_update_commit from PR_URL/COMMIT_URL). Add logic to promote dev scripts on merge: if record.is_dev === true, set is_dev to false and script_created to today, and log the promotion. Replace the previous duplicated date construction with the new patchBody.
This commit is contained in:
parent
e97053152a
commit
7e470080b6
1 changed files with 12 additions and 4 deletions
16
.github/workflows/update-script-timestamp-on-sh-change.yml
generated
vendored
16
.github/workflows/update-script-timestamp-on-sh-change.yml
generated
vendored
|
|
@ -155,13 +155,21 @@ jobs:
|
|||
console.log('Slug not in DB, skipping: ' + slug);
|
||||
continue;
|
||||
}
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const patchBody = {
|
||||
script_updated: today,
|
||||
last_update_commit: process.env.PR_URL || process.env.COMMIT_URL || ''
|
||||
};
|
||||
// When a dev script is merged into main, promote it to production
|
||||
if (record.is_dev === true) {
|
||||
patchBody.is_dev = false;
|
||||
patchBody.script_created = today;
|
||||
console.log('Promoting dev script to production: ' + slug);
|
||||
}
|
||||
const patchRes = await request(recordsUrl + '/' + record.id, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Authorization': token, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
script_updated: new Date().toISOString().split('T')[0],
|
||||
last_update_commit: process.env.PR_URL || process.env.COMMIT_URL || ''
|
||||
})
|
||||
body: JSON.stringify(patchBody)
|
||||
});
|
||||
if (!patchRes.ok) {
|
||||
console.warn('PATCH failed for slug ' + slug + ': ' + patchRes.body);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue