mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[AAE-15499] QA Failure provide more context on slack notification (#8720)
* sharing data with files * sharing data with files * disable check * add shell * skip step * skip step * fix tab * run e2e * failing e2e * failing e2e make fail * failing e2e make fail * use js action * fix template * test action * fix * fix test * fix test * use action * use action fix * use action fix * use action fix * use action fix * use action fix * use action fix * use action fix * use action fix * Normal run * verify slack groups * verify slack groups * verify slack groups * verify slack groups * refactor * remove useless code * remove useless code * use space as separator * use space as separator * use ga channel * append only for cron * run e2e job only if affected * simulate process * fix logic * fix logic * fix output * almost done
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
name: Append content to Artifact
|
||||
description: 'Allow the user to append content to an existing artifact'
|
||||
|
||||
inputs:
|
||||
artifact-name:
|
||||
description: 'The name of the artifact'
|
||||
required: true
|
||||
type: string
|
||||
file-name:
|
||||
description: 'The name of the file with extension created in the artifact'
|
||||
required: true
|
||||
type: string
|
||||
content:
|
||||
description: 'The content to append'
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
||||
steps:
|
||||
- run: echo "Artifact Append"
|
||||
shell: bash
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ inputs.artifact-name }}
|
||||
- run: ls
|
||||
shell: bash
|
||||
- name: Append content
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
contentFile: ${{ inputs.content }}
|
||||
fileName: ${{ inputs.file-name }}
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
|
||||
const affectedLib = process.env.contentFile;
|
||||
const fileName = process.env.fileName;
|
||||
core.info(`Input Filename: ${fileName}`);
|
||||
core.info(`Input content: ${affectedLib}`);
|
||||
|
||||
const content = read(fileName)
|
||||
core.info(`File content: ${content}`);
|
||||
appendContent(content, affectedLib);
|
||||
|
||||
function read(filename) {
|
||||
try {
|
||||
const contentFile = fs.readFileSync(filename, 'utf8').replace('\n','');
|
||||
return contentFile;
|
||||
} catch (err) {
|
||||
core.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
function write(filename, content) {
|
||||
try {
|
||||
fs.writeFileSync(filename, content);
|
||||
} catch (err) {
|
||||
core.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
function appendContent(content, append) {
|
||||
let changedContent;
|
||||
const libs = content.split(' ');
|
||||
if (libs?.length>0) {
|
||||
if (libs.length === 1 && libs[0] === '') {
|
||||
libs[0] = append;
|
||||
changedContent = libs[0];
|
||||
}
|
||||
else if (!libs.includes(append)) {
|
||||
libs.push(append);
|
||||
changedContent = libs.join(' ');
|
||||
} else {
|
||||
core.info(`Lib ${append} already affected`);
|
||||
}
|
||||
}
|
||||
if (changedContent != undefined){
|
||||
core.info(`File content append: ${changedContent}`)
|
||||
write(fileName, changedContent);
|
||||
}
|
||||
}
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ inputs.artifact-name }}
|
||||
path: ${{ inputs.file-name }}
|
||||
|
||||
Reference in New Issue
Block a user