From a0d6db364d4f8365266a4e13df52703d10ea2e72 Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sat, 24 Feb 2024 20:18:35 -0600 Subject: [PATCH 01/11] use branch main --- dist/index.js | 1662 ++++++++++++++++++++++++------------------------- src/index.js | 2 +- 2 files changed, 832 insertions(+), 832 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2bb870b..d00e8a0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -29560,836 +29560,836 @@ exports["default"] = _default; /***/ 8222: /***/ ((module) => { - - -var UZIP = {}; -if(true) module.exports = UZIP; - - -UZIP["parse"] = function(buf, onlyNames) // ArrayBuffer -{ - var rUs = UZIP.bin.readUshort, rUi = UZIP.bin.readUint, o = 0, out = {}; - var data = new Uint8Array(buf); - var eocd = data.length-4; - - while(rUi(data, eocd)!=0x06054b50) eocd--; - - var o = eocd; - o+=4; // sign = 0x06054b50 - o+=4; // disks = 0; - var cnu = rUs(data, o); o+=2; - var cnt = rUs(data, o); o+=2; - - var csize = rUi(data, o); o+=4; - var coffs = rUi(data, o); o+=4; - - o = coffs; - for(var i=0; i8514000) { - //console.log(PUtils.readASCII(buf , 8514500, 500)); - //console.log(PUtils.readASCII(nbuf, 8514500, 500)); - } - for(var i=0; i>>4); - //console.log(CM, CINFO,CMF,FLG); - return UZIP.inflateRaw(new Uint8Array(file.buffer, file.byteOffset+2, file.length-6), buf); -} -UZIP.deflate = function(data, opts/*, buf, off*/) { - if(opts==null) opts={level:6}; - var off=0, buf=new Uint8Array(50+Math.floor(data.length*1.1)); - buf[off]=120; buf[off+1]=156; off+=2; - off = UZIP.F.deflateRaw(data, buf, off, opts.level); - var crc = UZIP.adler(data, 0, data.length); - buf[off+0]=((crc>>>24)&255); - buf[off+1]=((crc>>>16)&255); - buf[off+2]=((crc>>> 8)&255); - buf[off+3]=((crc>>> 0)&255); - return new Uint8Array(buf.buffer, 0, off+4); -} -UZIP.deflateRaw = function(data, opts) { - if(opts==null) opts={level:6}; - var buf=new Uint8Array(50+Math.floor(data.length*1.1)); - var off = UZIP.F.deflateRaw(data, buf, off, opts.level); - return new Uint8Array(buf.buffer, 0, off); -} - - -UZIP.encode = function(obj, noCmpr) { - if(noCmpr==null) noCmpr=false; - var tot = 0, wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort; - var zpd = {}; - for(var p in obj) { var cpr = !UZIP._noNeed(p) && !noCmpr, buf = obj[p], crc = UZIP.crc.crc(buf,0,buf.length); - zpd[p] = { cpr:cpr, usize:buf.length, crc:crc, file: (cpr ? UZIP.deflateRaw(buf) : buf) }; } - - for(var p in zpd) tot += zpd[p].file.length + 30 + 46 + 2*UZIP.bin.sizeUTF8(p); - tot += 22; - - var data = new Uint8Array(tot), o = 0; - var fof = [] - - for(var p in zpd) { - var file = zpd[p]; fof.push(o); - o = UZIP._writeHeader(data, o, p, file, 0); - } - var i=0, ioff = o; - for(var p in zpd) { - var file = zpd[p]; fof.push(o); - o = UZIP._writeHeader(data, o, p, file, 1, fof[i++]); - } - var csize = o-ioff; - - wUi(data, o, 0x06054b50); o+=4; - o += 4; // disks - wUs(data, o, i); o += 2; - wUs(data, o, i); o += 2; // number of c d records - wUi(data, o, csize); o += 4; - wUi(data, o, ioff ); o += 4; - o += 2; - return data.buffer; -} -// no need to compress .PNG, .ZIP, .JPEG .... -UZIP._noNeed = function(fn) { var ext = fn.split(".").pop().toLowerCase(); return "png,jpg,jpeg,zip".indexOf(ext)!=-1; } - -UZIP._writeHeader = function(data, o, p, obj, t, roff) -{ - var wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort; - var file = obj.file; - - wUi(data, o, t==0 ? 0x04034b50 : 0x02014b50); o+=4; // sign - if(t==1) o+=2; // ver made by - wUs(data, o, 20); o+=2; // ver - wUs(data, o, 0); o+=2; // gflip - wUs(data, o, obj.cpr?8:0); o+=2; // cmpr - - wUi(data, o, 0); o+=4; // time - wUi(data, o, obj.crc); o+=4; // crc32 - wUi(data, o, file.length); o+=4; // csize - wUi(data, o, obj.usize); o+=4; // usize - - wUs(data, o, UZIP.bin.sizeUTF8(p)); o+=2; // nlen - wUs(data, o, 0); o+=2; // elen - - if(t==1) { - o += 2; // comment length - o += 2; // disk number - o += 6; // attributes - wUi(data, o, roff); o+=4; // usize - } - var nlen = UZIP.bin.writeUTF8(data, o, p); o+= nlen; - if(t==0) { data.set(file, o); o += file.length; } - return o; -} - - - - - -UZIP.crc = { - table : ( function() { - var tab = new Uint32Array(256); - for (var n=0; n<256; n++) { - var c = n; - for (var k=0; k<8; k++) { - if (c & 1) c = 0xedb88320 ^ (c >>> 1); - else c = c >>> 1; - } - tab[n] = c; } - return tab; })(), - update : function(c, buf, off, len) { - for (var i=0; i>> 8); - return c; - }, - crc : function(b,o,l) { return UZIP.crc.update(0xffffffff,b,o,l) ^ 0xffffffff; } -} -UZIP.adler = function(data,o,len) { - var a = 1, b = 0; - var off = o, end=o+len; - while(off>8)&255; }, - readUint : function(buff,p) { return (buff[p+3]*(256*256*256)) + ((buff[p+2]<<16) | (buff[p+1]<< 8) | buff[p]); }, - writeUint : function(buff,p,n){ buff[p]=n&255; buff[p+1]=(n>>8)&255; buff[p+2]=(n>>16)&255; buff[p+3]=(n>>24)&255; }, - readASCII : function(buff,p,l){ var s = ""; for(var i=0; i> 6)); buff[p+i+1] = (128|((code>> 0)&63)); i+=2; } - else if((code&(0xffffffff-(1<<16)+1))==0) { buff[p+i] = (224|(code>>12)); buff[p+i+1] = (128|((code>> 6)&63)); buff[p+i+2] = (128|((code>>0)&63)); i+=3; } - else if((code&(0xffffffff-(1<<21)+1))==0) { buff[p+i] = (240|(code>>18)); buff[p+i+1] = (128|((code>>12)&63)); buff[p+i+2] = (128|((code>>6)&63)); buff[p+i+3] = (128|((code>>0)&63)); i+=4; } - else throw "e"; - } - return i; - }, - sizeUTF8 : function(str) { - var strl = str.length, i=0; - for(var ci=0; ci>>3; - } - - var lits = U.lits, strt=U.strt, prev=U.prev, li=0, lc=0, bs=0, ebits=0, c=0, nc=0; // last_item, literal_count, block_start - if(dlen>2) { nc=UZIP.F._hash(data,0); strt[nc]=0; } - var nmch=0,nmci=0; - - for(i=0; i14000 || lc>26697) && (dlen-i)>100) { - if(cvrd>>16)>>16)>(mch>>>16)) mch=0; - }//*/ - var len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw "e"; - if(mch!=0) { - var len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw "e"; - var lgi = goodIndex(len, U.of0); U.lhst[257+lgi]++; - var dgi = goodIndex(dst, U.df0); U.dhst[ dgi]++; ebits += U.exb[lgi] + U.dxb[dgi]; - lits[li] = (len<<23)|(i-cvrd); lits[li+1] = (dst<<16)|(lgi<<8)|dgi; li+=2; - cvrd = i + len; - } - else { U.lhst[data[i]]++; } - lc++; - } - } - if(bs!=i || data.length==0) { - if(cvrd>>3; -} -UZIP.F._bestMatch = function(data, i, prev, c, nice, chain) { - var ci = (i&0x7fff), pi=prev[ci]; - //console.log("----", i); - var dif = ((ci-pi + (1<<15)) & 0x7fff); if(pi==ci || c!=UZIP.F._hash(data,i-dif)) return 0; - var tl=0, td=0; // top length, top distance - var dlim = Math.min(0x7fff, i); - while(dif<=dlim && --chain!=0 && pi!=ci /*&& c==UZIP.F._hash(data,i-dif)*/) { - if(tl==0 || (data[i+tl]==data[i+tl-dif])) { - var cl = UZIP.F._howLong(data, i, dif); - if(cl>tl) { - tl=cl; td=dif; if(tl>=nice) break; //* - if(dif+2maxd) { maxd=curd; pi = ei; } - } //*/ - } - } - - ci=pi; pi = prev[ci]; - dif += ((ci-pi + (1<<15)) & 0x7fff); - } - return (tl<<16)|td; -} -UZIP.F._howLong = function(data, i, dif) { - if(data[i]!=data[i-dif] || data[i+1]!=data[i+1-dif] || data[i+2]!=data[i+2-dif]) return 0; - var oi=i, l = Math.min(data.length, i+258); i+=3; - //while(i+4>>23), end = off+(qb&((1<<23)-1)); - while(off>16), lgi=(qc>>8)&255, dgi=(qc&255); - pos = UZIP.F._writeLit(257+lgi, ltree, out, pos); - putsE(out, pos, len-U.of0[lgi]); pos+=U.exb[lgi]; - - pos = UZIP.F._writeLit(dgi, dtree, out, pos); - putsF(out, pos, dst-U.df0[dgi]); pos+=U.dxb[dgi]; off+=len; - } - } - pos = UZIP.F._writeLit(256, ltree, out, pos); - } - //console.log(pos-opos, fxdSize, dynSize, cstSize); - return pos; -} -UZIP.F._copyExact = function(data,off,len,out,pos) { - var p8 = (pos>>>3); - out[p8]=(len); out[p8+1]=(len>>>8); out[p8+2]=255-out[p8]; out[p8+3]=255-out[p8+1]; p8+=4; - out.set(new Uint8Array(data.buffer, off, len), p8); - //for(var i=0; i4 && U.itree[(U.ordr[numh-1]<<1)+1]==0) numh--; - return [ML, MD, MH, numl, numd, numh, lset, dset]; -} -UZIP.F.getSecond= function(a) { var b=[]; for(var i=0; i>1)+","; return b; } -UZIP.F.contSize = function(tree, hst) { var s=0; for(var i=0; i15) { UZIP.F._putsE(out, pos, rst, rsl); pos+=rsl; } - } - return pos; -} -UZIP.F._lenCodes = function(tree, set) { - var len=tree.length; while(len!=2 && tree[len-1]==0) len-=2; // when no distances, keep one code with length 0 - for(var i=0; i>>1, 138); - if(zc<11) set.push(17, zc-3); - else set.push(18, zc-11); - i += zc*2-2; - } - else if(l==prv && nxt==l && nnxt==l) { - var lz = i+5; - while(lz+2>>1, 6); - set.push(16, zc-3); - i += zc*2-2; - } - else set.push(l, 0); - } - return len>>>1; -} -UZIP.F._hufTree = function(hst, tree, MAXL) { - var list=[], hl = hst.length, tl=tree.length, i=0; - for(i=0; iMAXL) { UZIP.F.restrictDepth(l2, MAXL, maxl); maxl = MAXL; } - for(i=0; iMD) { var od=dps[i].d; dps[i].d=MD; dbt+=bCost-(1<<(maxl-od)); } else break; - dbt = dbt>>>(maxl-MD); - while(dbt>0) { var od=dps[i].d; if(od=0; i--) if(dps[i].d==MD && dbt<0) { dps[i].d--; dbt++; } if(dbt!=0) console.log("debt left"); -} - -UZIP.F._goodIndex = function(v, arr) { - var i=0; if(arr[i|16]<=v) i|=16; if(arr[i|8]<=v) i|=8; if(arr[i|4]<=v) i|=4; if(arr[i|2]<=v) i|=2; if(arr[i|1]<=v) i|=1; return i; -} -UZIP.F._writeLit = function(ch, ltree, out, pos) { - UZIP.F._putsF(out, pos, ltree[ch<<1]); - return pos+ltree[(ch<<1)+1]; -} - - - - - - - - -UZIP.F.inflate = function(data, buf) { - var u8=Uint8Array; - if(data[0]==3 && data[1]==0) return (buf ? buf : new u8(0)); - var F=UZIP.F, bitsF = F._bitsF, bitsE = F._bitsE, decodeTiny = F._decodeTiny, makeCodes = F.makeCodes, codes2map=F.codes2map, get17 = F._get17; - var U = F.U; - - var noBuf = (buf==null); - if(noBuf) buf = new u8((data.length>>>2)<<3); - - var BFINAL=0, BTYPE=0, HLIT=0, HDIST=0, HCLEN=0, ML=0, MD=0; - var off = 0, pos = 0; - var lmap, dmap; - - while(BFINAL==0) { - BFINAL = bitsF(data, pos , 1); - BTYPE = bitsF(data, pos+1, 2); pos+=3; - //console.log(BFINAL, BTYPE); - - if(BTYPE==0) { - if((pos&7)!=0) pos+=8-(pos&7); - var p8 = (pos>>>3)+4, len = data[p8-4]|(data[p8-3]<<8); //console.log(len);//bitsF(data, pos, 16), - if(noBuf) buf=UZIP.F._check(buf, off+len); - buf.set(new u8(data.buffer, data.byteOffset+p8, len), off); - //for(var i=0; itl)tl=l; } pos+=3*HCLEN; //console.log(itree); - makeCodes(U.itree, tl); - codes2map(U.itree, tl, U.imap); - - lmap = U.lmap; dmap = U.dmap; - - pos = decodeTiny(U.imap, (1<>>24))-1; pos+=(ml&0xffffff); - makeCodes(U.ltree, mx0); - codes2map(U.ltree, mx0, lmap); - - //var md = decodeTiny(U.imap, (1<>>24))-1; pos+=(md&0xffffff); - makeCodes(U.dtree, mx1); - codes2map(U.dtree, mx1, dmap); - } - //var ooff=off, opos=pos; - while(true) { - var code = lmap[get17(data, pos) & ML]; pos += code&15; - var lit = code>>>4; //U.lhst[lit]++; - if((lit>>>8)==0) { buf[off++] = lit; } - else if(lit==256) { break; } - else { - var end = off+lit-254; - if(lit>264) { var ebs = U.ldef[lit-257]; end = off + (ebs>>>3) + bitsE(data, pos, ebs&7); pos += ebs&7; } - //UZIP.F.dst[end-off]++; - - var dcode = dmap[get17(data, pos) & MD]; pos += dcode&15; - var dlit = dcode>>>4; - var dbs = U.ddef[dlit], dst = (dbs>>>4) + bitsF(data, pos, dbs&15); pos += dbs&15; - - //var o0 = off-dst, stp = Math.min(end-off, dst); - //if(stp>20) while(off>>3); - } - //console.log(UZIP.F.dst); - //console.log(tlen, dlen, off-tlen+tcnt); - return buf.length==off ? buf : buf.slice(0,off); -} -UZIP.F._check=function(buf, len) { - var bl=buf.length; if(len<=bl) return buf; - var nbuf = new Uint8Array(Math.max(bl<<1,len)); nbuf.set(buf,0); - //for(var i=0; i>>4; - if(lit<=15) { tree[i]=lit; i++; } - else { - var ll = 0, n = 0; - if(lit==16) { - n = (3 + bitsE(data, pos, 2)); pos += 2; ll = tree[i-1]; - } - else if(lit==17) { - n = (3 + bitsE(data, pos, 3)); pos += 3; - } - else if(lit==18) { - n = (11 + bitsE(data, pos, 7)); pos += 7; - } - var ni = i+n; - while(i>>1; - while(imx)mx=v; i++; } - while(i>1; - var cl = tree[i+1], val = (lit<<4)|cl; // : (0x8000 | (U.of0[lit-257]<<7) | (U.exb[lit-257]<<4) | cl); - var rest = (MAX_BITS-cl), i0 = tree[i]<>>(15-MAX_BITS); - while(i0!=i1) { - var p0 = r15[i0]>>>(15-MAX_BITS); - map[p0]=val; i0++; - } - } -} -UZIP.F.revCodes = function(tree, MAX_BITS) { - var r15 = UZIP.F.U.rev15, imb = 15-MAX_BITS; - for(var i=0; i>>imb; } -} - -// used only in deflate -UZIP.F._putsE= function(dt, pos, val ) { val = val<<(pos&7); var o=(pos>>>3); dt[o]|=val; dt[o+1]|=(val>>>8); } -UZIP.F._putsF= function(dt, pos, val ) { val = val<<(pos&7); var o=(pos>>>3); dt[o]|=val; dt[o+1]|=(val>>>8); dt[o+2]|=(val>>>16); } - -UZIP.F._bitsE= function(dt, pos, length) { return ((dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) )>>>(pos&7))&((1<>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16))>>>(pos&7))&((1<>>3] | (dt[(pos>>>3)+1]<<8))>>>(pos&7))&511; -} */ -UZIP.F._get17= function(dt, pos) { // return at least 17 meaningful bytes - return (dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16) )>>>(pos&7); -} -UZIP.F._get25= function(dt, pos) { // return at least 17 meaningful bytes - return (dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16) | (dt[(pos>>>3)+3]<<24) )>>>(pos&7); -} -UZIP.F.U = function(){ - var u16=Uint16Array, u32=Uint32Array; - return { - next_code : new u16(16), - bl_count : new u16(16), - ordr : [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], - of0 : [3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999], - exb : [0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0], - ldef : new u16(32), - df0 : [1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 65535, 65535], - dxb : [0,0,0,0,1,1,2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0], - ddef : new u32(32), - flmap: new u16( 512), fltree: [], - fdmap: new u16( 32), fdtree: [], - lmap : new u16(32768), ltree : [], ttree:[], - dmap : new u16(32768), dtree : [], - imap : new u16( 512), itree : [], - //rev9 : new u16( 512) - rev15: new u16(1<<15), - lhst : new u32(286), dhst : new u32( 30), ihst : new u32(19), - lits : new u32(15000), - strt : new u16(1<<16), - prev : new u16(1<<15) - }; -} (); - -(function(){ - var U = UZIP.F.U; - var len = 1<<15; - for(var i=0; i>> 1) | ((x & 0x55555555) << 1)); - x = (((x & 0xcccccccc) >>> 2) | ((x & 0x33333333) << 2)); - x = (((x & 0xf0f0f0f0) >>> 4) | ((x & 0x0f0f0f0f) << 4)); - x = (((x & 0xff00ff00) >>> 8) | ((x & 0x00ff00ff) << 8)); - U.rev15[i] = (((x >>> 16) | (x << 16)))>>>17; - } - - function pushV(tgt, n, sv) { while(n--!=0) tgt.push(0,sv); } - - for(var i=0; i<32; i++) { U.ldef[i]=(U.of0[i]<<3)|U.exb[i]; U.ddef[i]=(U.df0[i]<<4)|U.dxb[i]; } - - pushV(U.fltree, 144, 8); pushV(U.fltree, 255-143, 9); pushV(U.fltree, 279-255, 7); pushV(U.fltree,287-279,8); - /* - var i = 0; - for(; i<=143; i++) U.fltree.push(0,8); - for(; i<=255; i++) U.fltree.push(0,9); - for(; i<=279; i++) U.fltree.push(0,7); - for(; i<=287; i++) U.fltree.push(0,8); - */ - UZIP.F.makeCodes(U.fltree, 9); - UZIP.F.codes2map(U.fltree, 9, U.flmap); - UZIP.F.revCodes (U.fltree, 9) - - pushV(U.fdtree,32,5); - //for(i=0;i<32; i++) U.fdtree.push(0,5); - UZIP.F.makeCodes(U.fdtree, 5); - UZIP.F.codes2map(U.fdtree, 5, U.fdmap); - UZIP.F.revCodes (U.fdtree, 5) - - pushV(U.itree,19,0); pushV(U.ltree,286,0); pushV(U.dtree,30,0); pushV(U.ttree,320,0); - /* - for(var i=0; i< 19; i++) U.itree.push(0,0); - for(var i=0; i<286; i++) U.ltree.push(0,0); - for(var i=0; i< 30; i++) U.dtree.push(0,0); - for(var i=0; i<320; i++) U.ttree.push(0,0); - */ -})() - - - - - - - - - - - - - - - - - - + + +var UZIP = {}; +if(true) module.exports = UZIP; + + +UZIP["parse"] = function(buf, onlyNames) // ArrayBuffer +{ + var rUs = UZIP.bin.readUshort, rUi = UZIP.bin.readUint, o = 0, out = {}; + var data = new Uint8Array(buf); + var eocd = data.length-4; + + while(rUi(data, eocd)!=0x06054b50) eocd--; + + var o = eocd; + o+=4; // sign = 0x06054b50 + o+=4; // disks = 0; + var cnu = rUs(data, o); o+=2; + var cnt = rUs(data, o); o+=2; + + var csize = rUi(data, o); o+=4; + var coffs = rUi(data, o); o+=4; + + o = coffs; + for(var i=0; i8514000) { + //console.log(PUtils.readASCII(buf , 8514500, 500)); + //console.log(PUtils.readASCII(nbuf, 8514500, 500)); + } + for(var i=0; i>>4); + //console.log(CM, CINFO,CMF,FLG); + return UZIP.inflateRaw(new Uint8Array(file.buffer, file.byteOffset+2, file.length-6), buf); +} +UZIP.deflate = function(data, opts/*, buf, off*/) { + if(opts==null) opts={level:6}; + var off=0, buf=new Uint8Array(50+Math.floor(data.length*1.1)); + buf[off]=120; buf[off+1]=156; off+=2; + off = UZIP.F.deflateRaw(data, buf, off, opts.level); + var crc = UZIP.adler(data, 0, data.length); + buf[off+0]=((crc>>>24)&255); + buf[off+1]=((crc>>>16)&255); + buf[off+2]=((crc>>> 8)&255); + buf[off+3]=((crc>>> 0)&255); + return new Uint8Array(buf.buffer, 0, off+4); +} +UZIP.deflateRaw = function(data, opts) { + if(opts==null) opts={level:6}; + var buf=new Uint8Array(50+Math.floor(data.length*1.1)); + var off = UZIP.F.deflateRaw(data, buf, off, opts.level); + return new Uint8Array(buf.buffer, 0, off); +} + + +UZIP.encode = function(obj, noCmpr) { + if(noCmpr==null) noCmpr=false; + var tot = 0, wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort; + var zpd = {}; + for(var p in obj) { var cpr = !UZIP._noNeed(p) && !noCmpr, buf = obj[p], crc = UZIP.crc.crc(buf,0,buf.length); + zpd[p] = { cpr:cpr, usize:buf.length, crc:crc, file: (cpr ? UZIP.deflateRaw(buf) : buf) }; } + + for(var p in zpd) tot += zpd[p].file.length + 30 + 46 + 2*UZIP.bin.sizeUTF8(p); + tot += 22; + + var data = new Uint8Array(tot), o = 0; + var fof = [] + + for(var p in zpd) { + var file = zpd[p]; fof.push(o); + o = UZIP._writeHeader(data, o, p, file, 0); + } + var i=0, ioff = o; + for(var p in zpd) { + var file = zpd[p]; fof.push(o); + o = UZIP._writeHeader(data, o, p, file, 1, fof[i++]); + } + var csize = o-ioff; + + wUi(data, o, 0x06054b50); o+=4; + o += 4; // disks + wUs(data, o, i); o += 2; + wUs(data, o, i); o += 2; // number of c d records + wUi(data, o, csize); o += 4; + wUi(data, o, ioff ); o += 4; + o += 2; + return data.buffer; +} +// no need to compress .PNG, .ZIP, .JPEG .... +UZIP._noNeed = function(fn) { var ext = fn.split(".").pop().toLowerCase(); return "png,jpg,jpeg,zip".indexOf(ext)!=-1; } + +UZIP._writeHeader = function(data, o, p, obj, t, roff) +{ + var wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort; + var file = obj.file; + + wUi(data, o, t==0 ? 0x04034b50 : 0x02014b50); o+=4; // sign + if(t==1) o+=2; // ver made by + wUs(data, o, 20); o+=2; // ver + wUs(data, o, 0); o+=2; // gflip + wUs(data, o, obj.cpr?8:0); o+=2; // cmpr + + wUi(data, o, 0); o+=4; // time + wUi(data, o, obj.crc); o+=4; // crc32 + wUi(data, o, file.length); o+=4; // csize + wUi(data, o, obj.usize); o+=4; // usize + + wUs(data, o, UZIP.bin.sizeUTF8(p)); o+=2; // nlen + wUs(data, o, 0); o+=2; // elen + + if(t==1) { + o += 2; // comment length + o += 2; // disk number + o += 6; // attributes + wUi(data, o, roff); o+=4; // usize + } + var nlen = UZIP.bin.writeUTF8(data, o, p); o+= nlen; + if(t==0) { data.set(file, o); o += file.length; } + return o; +} + + + + + +UZIP.crc = { + table : ( function() { + var tab = new Uint32Array(256); + for (var n=0; n<256; n++) { + var c = n; + for (var k=0; k<8; k++) { + if (c & 1) c = 0xedb88320 ^ (c >>> 1); + else c = c >>> 1; + } + tab[n] = c; } + return tab; })(), + update : function(c, buf, off, len) { + for (var i=0; i>> 8); + return c; + }, + crc : function(b,o,l) { return UZIP.crc.update(0xffffffff,b,o,l) ^ 0xffffffff; } +} +UZIP.adler = function(data,o,len) { + var a = 1, b = 0; + var off = o, end=o+len; + while(off>8)&255; }, + readUint : function(buff,p) { return (buff[p+3]*(256*256*256)) + ((buff[p+2]<<16) | (buff[p+1]<< 8) | buff[p]); }, + writeUint : function(buff,p,n){ buff[p]=n&255; buff[p+1]=(n>>8)&255; buff[p+2]=(n>>16)&255; buff[p+3]=(n>>24)&255; }, + readASCII : function(buff,p,l){ var s = ""; for(var i=0; i> 6)); buff[p+i+1] = (128|((code>> 0)&63)); i+=2; } + else if((code&(0xffffffff-(1<<16)+1))==0) { buff[p+i] = (224|(code>>12)); buff[p+i+1] = (128|((code>> 6)&63)); buff[p+i+2] = (128|((code>>0)&63)); i+=3; } + else if((code&(0xffffffff-(1<<21)+1))==0) { buff[p+i] = (240|(code>>18)); buff[p+i+1] = (128|((code>>12)&63)); buff[p+i+2] = (128|((code>>6)&63)); buff[p+i+3] = (128|((code>>0)&63)); i+=4; } + else throw "e"; + } + return i; + }, + sizeUTF8 : function(str) { + var strl = str.length, i=0; + for(var ci=0; ci>>3; + } + + var lits = U.lits, strt=U.strt, prev=U.prev, li=0, lc=0, bs=0, ebits=0, c=0, nc=0; // last_item, literal_count, block_start + if(dlen>2) { nc=UZIP.F._hash(data,0); strt[nc]=0; } + var nmch=0,nmci=0; + + for(i=0; i14000 || lc>26697) && (dlen-i)>100) { + if(cvrd>>16)>>16)>(mch>>>16)) mch=0; + }//*/ + var len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw "e"; + if(mch!=0) { + var len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw "e"; + var lgi = goodIndex(len, U.of0); U.lhst[257+lgi]++; + var dgi = goodIndex(dst, U.df0); U.dhst[ dgi]++; ebits += U.exb[lgi] + U.dxb[dgi]; + lits[li] = (len<<23)|(i-cvrd); lits[li+1] = (dst<<16)|(lgi<<8)|dgi; li+=2; + cvrd = i + len; + } + else { U.lhst[data[i]]++; } + lc++; + } + } + if(bs!=i || data.length==0) { + if(cvrd>>3; +} +UZIP.F._bestMatch = function(data, i, prev, c, nice, chain) { + var ci = (i&0x7fff), pi=prev[ci]; + //console.log("----", i); + var dif = ((ci-pi + (1<<15)) & 0x7fff); if(pi==ci || c!=UZIP.F._hash(data,i-dif)) return 0; + var tl=0, td=0; // top length, top distance + var dlim = Math.min(0x7fff, i); + while(dif<=dlim && --chain!=0 && pi!=ci /*&& c==UZIP.F._hash(data,i-dif)*/) { + if(tl==0 || (data[i+tl]==data[i+tl-dif])) { + var cl = UZIP.F._howLong(data, i, dif); + if(cl>tl) { + tl=cl; td=dif; if(tl>=nice) break; //* + if(dif+2maxd) { maxd=curd; pi = ei; } + } //*/ + } + } + + ci=pi; pi = prev[ci]; + dif += ((ci-pi + (1<<15)) & 0x7fff); + } + return (tl<<16)|td; +} +UZIP.F._howLong = function(data, i, dif) { + if(data[i]!=data[i-dif] || data[i+1]!=data[i+1-dif] || data[i+2]!=data[i+2-dif]) return 0; + var oi=i, l = Math.min(data.length, i+258); i+=3; + //while(i+4>>23), end = off+(qb&((1<<23)-1)); + while(off>16), lgi=(qc>>8)&255, dgi=(qc&255); + pos = UZIP.F._writeLit(257+lgi, ltree, out, pos); + putsE(out, pos, len-U.of0[lgi]); pos+=U.exb[lgi]; + + pos = UZIP.F._writeLit(dgi, dtree, out, pos); + putsF(out, pos, dst-U.df0[dgi]); pos+=U.dxb[dgi]; off+=len; + } + } + pos = UZIP.F._writeLit(256, ltree, out, pos); + } + //console.log(pos-opos, fxdSize, dynSize, cstSize); + return pos; +} +UZIP.F._copyExact = function(data,off,len,out,pos) { + var p8 = (pos>>>3); + out[p8]=(len); out[p8+1]=(len>>>8); out[p8+2]=255-out[p8]; out[p8+3]=255-out[p8+1]; p8+=4; + out.set(new Uint8Array(data.buffer, off, len), p8); + //for(var i=0; i4 && U.itree[(U.ordr[numh-1]<<1)+1]==0) numh--; + return [ML, MD, MH, numl, numd, numh, lset, dset]; +} +UZIP.F.getSecond= function(a) { var b=[]; for(var i=0; i>1)+","; return b; } +UZIP.F.contSize = function(tree, hst) { var s=0; for(var i=0; i15) { UZIP.F._putsE(out, pos, rst, rsl); pos+=rsl; } + } + return pos; +} +UZIP.F._lenCodes = function(tree, set) { + var len=tree.length; while(len!=2 && tree[len-1]==0) len-=2; // when no distances, keep one code with length 0 + for(var i=0; i>>1, 138); + if(zc<11) set.push(17, zc-3); + else set.push(18, zc-11); + i += zc*2-2; + } + else if(l==prv && nxt==l && nnxt==l) { + var lz = i+5; + while(lz+2>>1, 6); + set.push(16, zc-3); + i += zc*2-2; + } + else set.push(l, 0); + } + return len>>>1; +} +UZIP.F._hufTree = function(hst, tree, MAXL) { + var list=[], hl = hst.length, tl=tree.length, i=0; + for(i=0; iMAXL) { UZIP.F.restrictDepth(l2, MAXL, maxl); maxl = MAXL; } + for(i=0; iMD) { var od=dps[i].d; dps[i].d=MD; dbt+=bCost-(1<<(maxl-od)); } else break; + dbt = dbt>>>(maxl-MD); + while(dbt>0) { var od=dps[i].d; if(od=0; i--) if(dps[i].d==MD && dbt<0) { dps[i].d--; dbt++; } if(dbt!=0) console.log("debt left"); +} + +UZIP.F._goodIndex = function(v, arr) { + var i=0; if(arr[i|16]<=v) i|=16; if(arr[i|8]<=v) i|=8; if(arr[i|4]<=v) i|=4; if(arr[i|2]<=v) i|=2; if(arr[i|1]<=v) i|=1; return i; +} +UZIP.F._writeLit = function(ch, ltree, out, pos) { + UZIP.F._putsF(out, pos, ltree[ch<<1]); + return pos+ltree[(ch<<1)+1]; +} + + + + + + + + +UZIP.F.inflate = function(data, buf) { + var u8=Uint8Array; + if(data[0]==3 && data[1]==0) return (buf ? buf : new u8(0)); + var F=UZIP.F, bitsF = F._bitsF, bitsE = F._bitsE, decodeTiny = F._decodeTiny, makeCodes = F.makeCodes, codes2map=F.codes2map, get17 = F._get17; + var U = F.U; + + var noBuf = (buf==null); + if(noBuf) buf = new u8((data.length>>>2)<<3); + + var BFINAL=0, BTYPE=0, HLIT=0, HDIST=0, HCLEN=0, ML=0, MD=0; + var off = 0, pos = 0; + var lmap, dmap; + + while(BFINAL==0) { + BFINAL = bitsF(data, pos , 1); + BTYPE = bitsF(data, pos+1, 2); pos+=3; + //console.log(BFINAL, BTYPE); + + if(BTYPE==0) { + if((pos&7)!=0) pos+=8-(pos&7); + var p8 = (pos>>>3)+4, len = data[p8-4]|(data[p8-3]<<8); //console.log(len);//bitsF(data, pos, 16), + if(noBuf) buf=UZIP.F._check(buf, off+len); + buf.set(new u8(data.buffer, data.byteOffset+p8, len), off); + //for(var i=0; itl)tl=l; } pos+=3*HCLEN; //console.log(itree); + makeCodes(U.itree, tl); + codes2map(U.itree, tl, U.imap); + + lmap = U.lmap; dmap = U.dmap; + + pos = decodeTiny(U.imap, (1<>>24))-1; pos+=(ml&0xffffff); + makeCodes(U.ltree, mx0); + codes2map(U.ltree, mx0, lmap); + + //var md = decodeTiny(U.imap, (1<>>24))-1; pos+=(md&0xffffff); + makeCodes(U.dtree, mx1); + codes2map(U.dtree, mx1, dmap); + } + //var ooff=off, opos=pos; + while(true) { + var code = lmap[get17(data, pos) & ML]; pos += code&15; + var lit = code>>>4; //U.lhst[lit]++; + if((lit>>>8)==0) { buf[off++] = lit; } + else if(lit==256) { break; } + else { + var end = off+lit-254; + if(lit>264) { var ebs = U.ldef[lit-257]; end = off + (ebs>>>3) + bitsE(data, pos, ebs&7); pos += ebs&7; } + //UZIP.F.dst[end-off]++; + + var dcode = dmap[get17(data, pos) & MD]; pos += dcode&15; + var dlit = dcode>>>4; + var dbs = U.ddef[dlit], dst = (dbs>>>4) + bitsF(data, pos, dbs&15); pos += dbs&15; + + //var o0 = off-dst, stp = Math.min(end-off, dst); + //if(stp>20) while(off>>3); + } + //console.log(UZIP.F.dst); + //console.log(tlen, dlen, off-tlen+tcnt); + return buf.length==off ? buf : buf.slice(0,off); +} +UZIP.F._check=function(buf, len) { + var bl=buf.length; if(len<=bl) return buf; + var nbuf = new Uint8Array(Math.max(bl<<1,len)); nbuf.set(buf,0); + //for(var i=0; i>>4; + if(lit<=15) { tree[i]=lit; i++; } + else { + var ll = 0, n = 0; + if(lit==16) { + n = (3 + bitsE(data, pos, 2)); pos += 2; ll = tree[i-1]; + } + else if(lit==17) { + n = (3 + bitsE(data, pos, 3)); pos += 3; + } + else if(lit==18) { + n = (11 + bitsE(data, pos, 7)); pos += 7; + } + var ni = i+n; + while(i>>1; + while(imx)mx=v; i++; } + while(i>1; + var cl = tree[i+1], val = (lit<<4)|cl; // : (0x8000 | (U.of0[lit-257]<<7) | (U.exb[lit-257]<<4) | cl); + var rest = (MAX_BITS-cl), i0 = tree[i]<>>(15-MAX_BITS); + while(i0!=i1) { + var p0 = r15[i0]>>>(15-MAX_BITS); + map[p0]=val; i0++; + } + } +} +UZIP.F.revCodes = function(tree, MAX_BITS) { + var r15 = UZIP.F.U.rev15, imb = 15-MAX_BITS; + for(var i=0; i>>imb; } +} + +// used only in deflate +UZIP.F._putsE= function(dt, pos, val ) { val = val<<(pos&7); var o=(pos>>>3); dt[o]|=val; dt[o+1]|=(val>>>8); } +UZIP.F._putsF= function(dt, pos, val ) { val = val<<(pos&7); var o=(pos>>>3); dt[o]|=val; dt[o+1]|=(val>>>8); dt[o+2]|=(val>>>16); } + +UZIP.F._bitsE= function(dt, pos, length) { return ((dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) )>>>(pos&7))&((1<>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16))>>>(pos&7))&((1<>>3] | (dt[(pos>>>3)+1]<<8))>>>(pos&7))&511; +} */ +UZIP.F._get17= function(dt, pos) { // return at least 17 meaningful bytes + return (dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16) )>>>(pos&7); +} +UZIP.F._get25= function(dt, pos) { // return at least 17 meaningful bytes + return (dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16) | (dt[(pos>>>3)+3]<<24) )>>>(pos&7); +} +UZIP.F.U = function(){ + var u16=Uint16Array, u32=Uint32Array; + return { + next_code : new u16(16), + bl_count : new u16(16), + ordr : [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], + of0 : [3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999], + exb : [0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0], + ldef : new u16(32), + df0 : [1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 65535, 65535], + dxb : [0,0,0,0,1,1,2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0], + ddef : new u32(32), + flmap: new u16( 512), fltree: [], + fdmap: new u16( 32), fdtree: [], + lmap : new u16(32768), ltree : [], ttree:[], + dmap : new u16(32768), dtree : [], + imap : new u16( 512), itree : [], + //rev9 : new u16( 512) + rev15: new u16(1<<15), + lhst : new u32(286), dhst : new u32( 30), ihst : new u32(19), + lits : new u32(15000), + strt : new u16(1<<16), + prev : new u16(1<<15) + }; +} (); + +(function(){ + var U = UZIP.F.U; + var len = 1<<15; + for(var i=0; i>> 1) | ((x & 0x55555555) << 1)); + x = (((x & 0xcccccccc) >>> 2) | ((x & 0x33333333) << 2)); + x = (((x & 0xf0f0f0f0) >>> 4) | ((x & 0x0f0f0f0f) << 4)); + x = (((x & 0xff00ff00) >>> 8) | ((x & 0x00ff00ff) << 8)); + U.rev15[i] = (((x >>> 16) | (x << 16)))>>>17; + } + + function pushV(tgt, n, sv) { while(n--!=0) tgt.push(0,sv); } + + for(var i=0; i<32; i++) { U.ldef[i]=(U.of0[i]<<3)|U.exb[i]; U.ddef[i]=(U.df0[i]<<4)|U.dxb[i]; } + + pushV(U.fltree, 144, 8); pushV(U.fltree, 255-143, 9); pushV(U.fltree, 279-255, 7); pushV(U.fltree,287-279,8); + /* + var i = 0; + for(; i<=143; i++) U.fltree.push(0,8); + for(; i<=255; i++) U.fltree.push(0,9); + for(; i<=279; i++) U.fltree.push(0,7); + for(; i<=287; i++) U.fltree.push(0,8); + */ + UZIP.F.makeCodes(U.fltree, 9); + UZIP.F.codes2map(U.fltree, 9, U.flmap); + UZIP.F.revCodes (U.fltree, 9) + + pushV(U.fdtree,32,5); + //for(i=0;i<32; i++) U.fdtree.push(0,5); + UZIP.F.makeCodes(U.fdtree, 5); + UZIP.F.codes2map(U.fdtree, 5, U.fdmap); + UZIP.F.revCodes (U.fdtree, 5) + + pushV(U.itree,19,0); pushV(U.ltree,286,0); pushV(U.dtree,30,0); pushV(U.ttree,320,0); + /* + for(var i=0; i< 19; i++) U.itree.push(0,0); + for(var i=0; i<286; i++) U.ltree.push(0,0); + for(var i=0; i< 30; i++) U.dtree.push(0,0); + for(var i=0; i<320; i++) U.ttree.push(0,0); + */ +})() + + + + + + + + + + + + + + + + + + /***/ }), @@ -32399,7 +32399,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); (async function () { const owner = "replayableio"; const repo = "testdriver"; - const branch = "michael/flag-based-action-or-bot"; + const branch = "main"; const dispatchWorkflow = "interpret-comment.yml"; const octokit = github.getOctokit(process.env.GH_TOKEN); diff --git a/src/index.js b/src/index.js index 5d8b095..0233ef0 100644 --- a/src/index.js +++ b/src/index.js @@ -15,7 +15,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); (async function () { const owner = "replayableio"; const repo = "testdriver"; - const branch = "michael/flag-based-action-or-bot"; + const branch = "main"; const dispatchWorkflow = "interpret-comment.yml"; const octokit = github.getOctokit(process.env.GH_TOKEN); From bbe91d4b7eb376b515f4be5ee2aa67fe42a0b9c0 Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sat, 24 Feb 2024 20:45:50 -0600 Subject: [PATCH 02/11] more fun action logs --- action.yml | 16 ++- package-lock.json | 292 +--------------------------------------------- package.json | 1 + src/index.js | 48 +++++++- 4 files changed, 60 insertions(+), 297 deletions(-) diff --git a/action.yml b/action.yml index 3e50311..1bd3e9a 100644 --- a/action.yml +++ b/action.yml @@ -1,13 +1,17 @@ name: Dashcam TestDriver -description: Run tests based on human language -author: Michael Layne +description: AI QA Agent for GitHub +author: Dashcam.io branding: - icon: "box" - color: "orange" + icon: "user-plus" + color: "green" inputs: prompt: description: >- - Your test prompt + The prompt to test. Example: + 1. Open Google Chrome + 2. Go to YouTube.com + 3. Search for "Rick Astley" + 4. Click on the first video required: true outputs: @@ -16,7 +20,7 @@ outputs: The summary of the test result shareLink: description: >- - The share link of dash recording + The share link of Dashcam.io recording runs: using: node16 main: ./dist/index.js diff --git a/package-lock.json b/package-lock.json index 4c0352d..bac8a24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,293 +1,11 @@ { - "name": "testdriver-bot-action", - "lockfileVersion": 3, "requires": true, - "packages": { - "": { - "dependencies": { - "@actions/core": "^1.10.1", - "@actions/github": "^6.0.0", - "@octokit/rest": "^20.0.2", - "uuid": "^9.0.1", - "uzip": "^0.20201231.0" - }, - "devDependencies": { - "@vercel/ncc": "^0.38.1", - "dotenv": "^16.4.5" - } - }, - "node_modules/@actions/core": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", - "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", - "dependencies": { - "@actions/http-client": "^2.0.1", - "uuid": "^8.3.2" - } - }, - "node_modules/@actions/core/node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/@actions/github": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", - "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", - "dependencies": { - "@actions/http-client": "^2.2.0", - "@octokit/core": "^5.0.1", - "@octokit/plugin-paginate-rest": "^9.0.0", - "@octokit/plugin-rest-endpoint-methods": "^10.0.0" - } - }, - "node_modules/@actions/http-client": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz", - "integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==", - "dependencies": { - "tunnel": "^0.0.6", - "undici": "^5.25.4" - } - }, - "node_modules/@fastify/busboy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", - "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", - "engines": { - "node": ">=14" - } - }, - "node_modules/@octokit/auth-token": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", - "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/core": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.1.0.tgz", - "integrity": "sha512-BDa2VAMLSh3otEiaMJ/3Y36GU4qf6GI+VivQ/P41NC6GHcdxpKlqV0ikSZ5gdQsmS3ojXeRx5vasgNTinF0Q4g==", - "dependencies": { - "@octokit/auth-token": "^4.0.0", - "@octokit/graphql": "^7.0.0", - "@octokit/request": "^8.0.2", - "@octokit/request-error": "^5.0.0", - "@octokit/types": "^12.0.0", - "before-after-hook": "^2.2.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/endpoint": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.4.tgz", - "integrity": "sha512-DWPLtr1Kz3tv8L0UvXTDP1fNwM0S+z6EJpRcvH66orY6Eld4XBMCSYsaWp4xIm61jTWxK68BrR7ibO+vSDnZqw==", - "dependencies": { - "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/graphql": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.0.2.tgz", - "integrity": "sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==", - "dependencies": { - "@octokit/request": "^8.0.1", - "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/openapi-types": { - "version": "19.1.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.1.0.tgz", - "integrity": "sha512-6G+ywGClliGQwRsjvqVYpklIfa7oRPA0vyhPQG/1Feh+B+wU0vGH1JiJ5T25d3g1JZYBHzR2qefLi9x8Gt+cpw==" - }, - "node_modules/@octokit/plugin-paginate-rest": { - "version": "9.1.5", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.1.5.tgz", - "integrity": "sha512-WKTQXxK+bu49qzwv4qKbMMRXej1DU2gq017euWyKVudA6MldaSSQuxtz+vGbhxV4CjxpUxjZu6rM2wfc1FiWVg==", - "dependencies": { - "@octokit/types": "^12.4.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=5" - } - }, - "node_modules/@octokit/plugin-request-log": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.0.tgz", - "integrity": "sha512-2uJI1COtYCq8Z4yNSnM231TgH50bRkheQ9+aH8TnZanB6QilOnx8RMD2qsnamSOXtDj0ilxvevf5fGsBhBBzKA==", - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=5" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.2.0.tgz", - "integrity": "sha512-ePbgBMYtGoRNXDyKGvr9cyHjQ163PbwD0y1MkDJCpkO2YH4OeXX40c4wYHKikHGZcpGPbcRLuy0unPUuafco8Q==", - "dependencies": { - "@octokit/types": "^12.3.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=5" - } - }, - "node_modules/@octokit/request": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.2.0.tgz", - "integrity": "sha512-exPif6x5uwLqv1N1irkLG1zZNJkOtj8bZxuVHd71U5Ftuxf2wGNvAJyNBcPbPC+EBzwYEbBDdSFb8EPcjpYxPQ==", - "dependencies": { - "@octokit/endpoint": "^9.0.0", - "@octokit/request-error": "^5.0.0", - "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/request-error": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.1.tgz", - "integrity": "sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==", - "dependencies": { - "@octokit/types": "^12.0.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/rest": { - "version": "20.0.2", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-20.0.2.tgz", - "integrity": "sha512-Ux8NDgEraQ/DMAU1PlAohyfBBXDwhnX2j33Z1nJNziqAfHi70PuxkFYIcIt8aIAxtRE7KVuKp8lSR8pA0J5iOQ==", - "dependencies": { - "@octokit/core": "^5.0.0", - "@octokit/plugin-paginate-rest": "^9.0.0", - "@octokit/plugin-request-log": "^4.0.0", - "@octokit/plugin-rest-endpoint-methods": "^10.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/types": { - "version": "12.5.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.5.0.tgz", - "integrity": "sha512-YJEKcb0KkJlIUNU/zjnZwHEP8AoVh/OoIcP/1IyR4UHxExz7fzpe/a8IG4wBtQi7QDEqiomVLX88S6FpxxAJtg==", - "dependencies": { - "@octokit/openapi-types": "^19.1.0" - } - }, - "node_modules/@vercel/ncc": { - "version": "0.38.1", - "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz", - "integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==", - "dev": true, - "bin": { - "ncc": "dist/ncc/cli.js" - } - }, - "node_modules/before-after-hook": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", - "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" - }, - "node_modules/deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" - }, - "node_modules/dotenv": { - "version": "16.4.5", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", - "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, - "node_modules/once": { + "lockfileVersion": 1, + "dependencies": { + "colors": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - }, - "node_modules/undici": { - "version": "5.28.3", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", - "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, - "node_modules/universal-user-agent": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", - "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==" - }, - "node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/uzip": { - "version": "0.20201231.0", - "resolved": "https://registry.npmjs.org/uzip/-/uzip-0.20201231.0.tgz", - "integrity": "sha512-OZeJfZP+R0z9D6TmBgLq2LHzSSptGMGDGigGiEe0pr8UBe/7fdflgHlHBNDASTXB5jnFuxHpNaJywSg8YFeGng==" - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" } } } diff --git a/package.json b/package.json index 85067de..ebddeef 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "@actions/core": "^1.10.1", "@actions/github": "^6.0.0", "@octokit/rest": "^20.0.2", + "colors": "^1.4.0", "uuid": "^9.0.1", "uzip": "^0.20201231.0" }, diff --git a/src/index.js b/src/index.js index a1110c8..be5979b 100644 --- a/src/index.js +++ b/src/index.js @@ -3,6 +3,7 @@ const github = require("@actions/github"); const config = require("./config"); import { v4 as uuidv4 } from "uuid"; const UZip = require("uzip"); +const colors = require("colors"); function setOutput(summary, shareLink, conclusion) { core.setOutput("summary", summary); @@ -10,6 +11,18 @@ function setOutput(summary, shareLink, conclusion) { core.setOutput("conclusion", conclusion); } +function extractLink(markdownString) { + const regex = /\[.*?\]\((.*?)\)/g; + const urls = []; + let match; + + while ((match = regex.exec(markdownString)) !== null) { + urls.push(match[1]); + } + + return urls; +} + const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); (async function () { @@ -22,6 +35,9 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); const dispatchId = uuidv4(); + console.log('TestDriver: "I can help ya test that!"'.green); + console.log('TestDriver: "Looking into it..."'.green); + await octokit.request( "POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", { @@ -89,15 +105,21 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); let workflowId; while (!workflowId) { await waitFor(1000 * 60); + console.log('TestDriver: "Setting Up..."'.green); workflowId = await findWorkFlow(); } return workflowId; }; + console.log('TestDriver: "I\'m workin on it!"'.green); + const workflowId = await waitUntilWorkflowAvailable(); - console.log("workflow found", workflowId); + console.log( + 'TestDriver: "I\'m all set up and ready to take this thing for a drive!"' + .green + ); const checkStatus = async () => { const workflow = await octokit.request( @@ -115,10 +137,13 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); }; }; + console.log('TestDriver: "Let\'s Go!"'.green); + const waitUntilComplete = async () => { let { status, conclusion } = await checkStatus(); while (status != "completed") { await waitFor(1000 * 60 * 1); + console.log('TestDriver: "Testing..."'.green); const resp = await checkStatus(); status = resp.status; conclusion = resp.conclusion; @@ -129,7 +154,9 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); const conclusion = await waitUntilComplete(); - console.log("completed with ", conclusion); + console.log('TestDriver: "Done!"'.green); + + console.log('TestDriver: "Writing my report..."'.green); // list workflow run artifacts const artifacts = await octokit.request( @@ -149,6 +176,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } } + console.log('TestDriver: "Interpreting results..."'.green); + // download the artifact let downloadedArtifact = await octokit.request( "GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}", @@ -160,6 +189,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } ); + console.log('TestDriver: "Decoding..."'.green); + // get file data let unzippedData = UZip.parse(downloadedArtifact.data); const textDecoder = new TextDecoder(); @@ -172,6 +203,15 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); core.setFailed(oiResult); } - console.log(shareLink, oiResult, conclusion); - setOutput(shareLink, oiResult, conclusion); + if (isPassed) { + console.log('TestDriver: "PASS"'.green); + } else { + console.log('TestDriver: "FAIL"'.red); + } + + console.log("View Test Results on Dashcam.io".yellow); + console.log(extractLink(shareLink)); + + console.log("TestDriver.ai Summary".yellow); + console.log(oiResult); })(); From 3e4017e74e0d94c0cecfeeb504d8349c2205dc5d Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sat, 24 Feb 2024 21:08:29 -0600 Subject: [PATCH 03/11] Create README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..f8a4f12 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +Example here: +https://github.com/replayableio/testdriver-wave + +Supply a `.testdriver/prerun.sh` script to run shell script before AI AGent From d6acb016449be4670b109dcf2512728f5d619c4a Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sat, 24 Feb 2024 21:08:45 -0600 Subject: [PATCH 04/11] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f8a4f12..e3d3154 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# TestDriver.ai + Example here: https://github.com/replayableio/testdriver-wave From 528fa751aae37b4ee5a6714e7e1e199040dc4534 Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sat, 24 Feb 2024 21:12:57 -0600 Subject: [PATCH 05/11] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e3d3154..75bee53 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,9 @@ Example here: https://github.com/replayableio/testdriver-wave Supply a `.testdriver/prerun.sh` script to run shell script before AI AGent + +1. Generate token in developer settings +![CleanShot 2024-02-24 at 21 11 39](https://github.com/replayableio/testdriver-action/assets/318295/b21dd152-c183-4ce0-987f-31c2e511d3e6) + +2. Store as a secret +3. ![CleanShot 2024-02-24 at 21 12 01](https://github.com/replayableio/testdriver-action/assets/318295/9e33a4ef-f885-42a1-be19-2139266ab6de) From 2ec8e0315af22c88f6ed66b6276343f1ece30214 Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sun, 25 Feb 2024 10:26:01 -0600 Subject: [PATCH 06/11] build updates --- .github/workflows/pr.yml | 2 +- dist/index.js | 1014 +++++++++++++++++++++++++++++++++++++- package-lock.json | 208 ++++++++ 3 files changed, 1214 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4e707a2..72d0c0e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - uses: ./ + - uses: replayableio/testdriver-action with: prompt: | 1. open youtube. diff --git a/dist/index.js b/dist/index.js index d00e8a0..98b8005 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3563,7 +3563,7 @@ __export(dist_src_exports, { module.exports = __toCommonJS(dist_src_exports); // pkg/dist-src/version.js -var VERSION = "9.1.5"; +var VERSION = "9.2.0"; // pkg/dist-src/normalize-paginated-list-response.js function normalizePaginatedListResponse(response) { @@ -3724,6 +3724,8 @@ var paginatingEndpoints = [ "GET /orgs/{org}/members/{username}/codespaces", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", + "GET /orgs/{org}/organization-roles/{role_id}/teams", + "GET /orgs/{org}/organization-roles/{role_id}/users", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", @@ -3960,7 +3962,7 @@ __export(dist_src_exports, { module.exports = __toCommonJS(dist_src_exports); // pkg/dist-src/version.js -var VERSION = "10.2.0"; +var VERSION = "10.4.0"; // pkg/dist-src/generated/endpoints.js var Endpoints = { @@ -4087,6 +4089,9 @@ var Endpoints = { "GET /repos/{owner}/{repo}/actions/permissions/selected-actions" ], getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + getCustomOidcSubClaimForRepo: [ + "GET /repos/{owner}/{repo}/actions/oidc/customization/sub" + ], getEnvironmentPublicKey: [ "GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key" ], @@ -4239,6 +4244,9 @@ var Endpoints = { setCustomLabelsForSelfHostedRunnerForRepo: [ "PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels" ], + setCustomOidcSubClaimForRepo: [ + "PUT /repos/{owner}/{repo}/actions/oidc/customization/sub" + ], setGithubActionsDefaultWorkflowPermissionsOrganization: [ "PUT /orgs/{org}/actions/permissions/workflow" ], @@ -4308,6 +4316,7 @@ var Endpoints = { listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"], markNotificationsAsRead: ["PUT /notifications"], markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"], + markThreadAsDone: ["DELETE /notifications/threads/{thread_id}"], markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"], setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"], setThreadSubscription: [ @@ -4584,10 +4593,10 @@ var Endpoints = { updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"] }, copilot: { - addCopilotForBusinessSeatsForTeams: [ + addCopilotSeatsForTeams: [ "POST /orgs/{org}/copilot/billing/selected_teams" ], - addCopilotForBusinessSeatsForUsers: [ + addCopilotSeatsForUsers: [ "POST /orgs/{org}/copilot/billing/selected_users" ], cancelCopilotSeatAssignmentForTeams: [ @@ -4900,10 +4909,24 @@ var Endpoints = { } ] }, + oidc: { + getOidcCustomSubTemplateForOrg: [ + "GET /orgs/{org}/actions/oidc/customization/sub" + ], + updateOidcCustomSubTemplateForOrg: [ + "PUT /orgs/{org}/actions/oidc/customization/sub" + ] + }, orgs: { addSecurityManagerTeam: [ "PUT /orgs/{org}/security-managers/teams/{team_slug}" ], + assignTeamToOrgRole: [ + "PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}" + ], + assignUserToOrgRole: [ + "PUT /orgs/{org}/organization-roles/users/{username}/{role_id}" + ], blockUser: ["PUT /orgs/{org}/blocks/{username}"], cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"], checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"], @@ -4912,6 +4935,7 @@ var Endpoints = { convertMemberToOutsideCollaborator: [ "PUT /orgs/{org}/outside_collaborators/{username}" ], + createCustomOrganizationRole: ["POST /orgs/{org}/organization-roles"], createInvitation: ["POST /orgs/{org}/invitations"], createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"], createOrUpdateCustomPropertiesValuesForRepos: [ @@ -4922,6 +4946,9 @@ var Endpoints = { ], createWebhook: ["POST /orgs/{org}/hooks"], delete: ["DELETE /orgs/{org}"], + deleteCustomOrganizationRole: [ + "DELETE /orgs/{org}/organization-roles/{role_id}" + ], deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], enableOrDisableSecurityProductOnAllOrgRepos: [ "POST /orgs/{org}/{security_product}/{enablement}" @@ -4933,6 +4960,7 @@ var Endpoints = { ], getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], + getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"], getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"], getWebhookDelivery: [ @@ -4948,6 +4976,12 @@ var Endpoints = { listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], listMembers: ["GET /orgs/{org}/members"], listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"], + listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"], + listOrgRoleUsers: ["GET /orgs/{org}/organization-roles/{role_id}/users"], + listOrgRoles: ["GET /orgs/{org}/organization-roles"], + listOrganizationFineGrainedPermissions: [ + "GET /orgs/{org}/organization-fine-grained-permissions" + ], listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"], listPatGrantRepositories: [ "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories" @@ -4962,6 +4996,9 @@ var Endpoints = { listSecurityManagerTeams: ["GET /orgs/{org}/security-managers"], listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"], listWebhooks: ["GET /orgs/{org}/hooks"], + patchCustomOrganizationRole: [ + "PATCH /orgs/{org}/organization-roles/{role_id}" + ], pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"], redeliverWebhookDelivery: [ "POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts" @@ -4986,6 +5023,18 @@ var Endpoints = { reviewPatGrantRequestsInBulk: [ "POST /orgs/{org}/personal-access-token-requests" ], + revokeAllOrgRolesTeam: [ + "DELETE /orgs/{org}/organization-roles/teams/{team_slug}" + ], + revokeAllOrgRolesUser: [ + "DELETE /orgs/{org}/organization-roles/users/{username}" + ], + revokeOrgRoleTeam: [ + "DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}" + ], + revokeOrgRoleUser: [ + "DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}" + ], setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"], setPublicMembershipForAuthenticatedUser: [ "PUT /orgs/{org}/public_members/{username}" @@ -5276,6 +5325,9 @@ var Endpoints = { {}, { mapToData: "users" } ], + cancelPagesDeployment: [ + "POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel" + ], checkAutomatedSecurityFixes: [ "GET /repos/{owner}/{repo}/automated-security-fixes" ], @@ -5311,12 +5363,15 @@ var Endpoints = { createForAuthenticatedUser: ["POST /user/repos"], createFork: ["POST /repos/{owner}/{repo}/forks"], createInOrg: ["POST /orgs/{org}/repos"], + createOrUpdateCustomPropertiesValues: [ + "PATCH /repos/{owner}/{repo}/properties/values" + ], createOrUpdateEnvironment: [ "PUT /repos/{owner}/{repo}/environments/{environment_name}" ], createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"], createOrgRuleset: ["POST /orgs/{org}/rulesets"], - createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployment"], + createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployments"], createPagesSite: ["POST /repos/{owner}/{repo}/pages"], createRelease: ["POST /repos/{owner}/{repo}/releases"], createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"], @@ -5469,6 +5524,9 @@ var Endpoints = { getOrgRulesets: ["GET /orgs/{org}/rulesets"], getPages: ["GET /repos/{owner}/{repo}/pages"], getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"], + getPagesDeployment: [ + "GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}" + ], getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"], getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"], getPullRequestReviewProtection: [ @@ -5679,6 +5737,9 @@ var Endpoints = { ] }, securityAdvisories: { + createFork: [ + "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks" + ], createPrivateVulnerabilityReport: [ "POST /repos/{owner}/{repo}/security-advisories/reports" ], @@ -6545,6 +6606,901 @@ function removeHook(state, name, method) { } +/***/ }), + +/***/ 3595: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/* + +The MIT License (MIT) + +Original Library + - Copyright (c) Marak Squires + +Additional functionality + - Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + +var colors = {}; +module['exports'] = colors; + +colors.themes = {}; + +var util = __nccwpck_require__(3837); +var ansiStyles = colors.styles = __nccwpck_require__(3104); +var defineProps = Object.defineProperties; +var newLineRegex = new RegExp(/[\r\n]+/g); + +colors.supportsColor = (__nccwpck_require__(662).supportsColor); + +if (typeof colors.enabled === 'undefined') { + colors.enabled = colors.supportsColor() !== false; +} + +colors.enable = function() { + colors.enabled = true; +}; + +colors.disable = function() { + colors.enabled = false; +}; + +colors.stripColors = colors.strip = function(str) { + return ('' + str).replace(/\x1B\[\d+m/g, ''); +}; + +// eslint-disable-next-line no-unused-vars +var stylize = colors.stylize = function stylize(str, style) { + if (!colors.enabled) { + return str+''; + } + + var styleMap = ansiStyles[style]; + + // Stylize should work for non-ANSI styles, too + if(!styleMap && style in colors){ + // Style maps like trap operate as functions on strings; + // they don't have properties like open or close. + return colors[style](str); + } + + return styleMap.open + str + styleMap.close; +}; + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; +var escapeStringRegexp = function(str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + return str.replace(matchOperatorsRe, '\\$&'); +}; + +function build(_styles) { + var builder = function builder() { + return applyStyle.apply(builder, arguments); + }; + builder._styles = _styles; + // __proto__ is used because we must return a function, but there is + // no way to create a function with a different prototype. + builder.__proto__ = proto; + return builder; +} + +var styles = (function() { + var ret = {}; + ansiStyles.grey = ansiStyles.gray; + Object.keys(ansiStyles).forEach(function(key) { + ansiStyles[key].closeRe = + new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + ret[key] = { + get: function() { + return build(this._styles.concat(key)); + }, + }; + }); + return ret; +})(); + +var proto = defineProps(function colors() {}, styles); + +function applyStyle() { + var args = Array.prototype.slice.call(arguments); + + var str = args.map(function(arg) { + // Use weak equality check so we can colorize null/undefined in safe mode + if (arg != null && arg.constructor === String) { + return arg; + } else { + return util.inspect(arg); + } + }).join(' '); + + if (!colors.enabled || !str) { + return str; + } + + var newLinesPresent = str.indexOf('\n') != -1; + + var nestedStyles = this._styles; + + var i = nestedStyles.length; + while (i--) { + var code = ansiStyles[nestedStyles[i]]; + str = code.open + str.replace(code.closeRe, code.open) + code.close; + if (newLinesPresent) { + str = str.replace(newLineRegex, function(match) { + return code.close + match + code.open; + }); + } + } + + return str; +} + +colors.setTheme = function(theme) { + if (typeof theme === 'string') { + console.log('colors.setTheme now only accepts an object, not a string. ' + + 'If you are trying to set a theme from a file, it is now your (the ' + + 'caller\'s) responsibility to require the file. The old syntax ' + + 'looked like colors.setTheme(__dirname + ' + + '\'/../themes/generic-logging.js\'); The new syntax looks like '+ + 'colors.setTheme(require(__dirname + ' + + '\'/../themes/generic-logging.js\'));'); + return; + } + for (var style in theme) { + (function(style) { + colors[style] = function(str) { + if (typeof theme[style] === 'object') { + var out = str; + for (var i in theme[style]) { + out = colors[theme[style][i]](out); + } + return out; + } + return colors[theme[style]](str); + }; + })(style); + } +}; + +function init() { + var ret = {}; + Object.keys(styles).forEach(function(name) { + ret[name] = { + get: function() { + return build([name]); + }, + }; + }); + return ret; +} + +var sequencer = function sequencer(map, str) { + var exploded = str.split(''); + exploded = exploded.map(map); + return exploded.join(''); +}; + +// custom formatter methods +colors.trap = __nccwpck_require__(1302); +colors.zalgo = __nccwpck_require__(7743); + +// maps +colors.maps = {}; +colors.maps.america = __nccwpck_require__(6936)(colors); +colors.maps.zebra = __nccwpck_require__(2989)(colors); +colors.maps.rainbow = __nccwpck_require__(5210)(colors); +colors.maps.random = __nccwpck_require__(3441)(colors); + +for (var map in colors.maps) { + (function(map) { + colors[map] = function(str) { + return sequencer(colors.maps[map], str); + }; + })(map); +} + +defineProps(colors, init()); + + +/***/ }), + +/***/ 1302: +/***/ ((module) => { + +module['exports'] = function runTheTrap(text, options) { + var result = ''; + text = text || 'Run the trap, drop the bass'; + text = text.split(''); + var trap = { + a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'], + b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'], + c: ['\u00a9', '\u023b', '\u03fe'], + d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'], + e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc', + '\u0a6c'], + f: ['\u04fa'], + g: ['\u0262'], + h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'], + i: ['\u0f0f'], + j: ['\u0134'], + k: ['\u0138', '\u04a0', '\u04c3', '\u051e'], + l: ['\u0139'], + m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'], + n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'], + o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd', + '\u06dd', '\u0e4f'], + p: ['\u01f7', '\u048e'], + q: ['\u09cd'], + r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'], + s: ['\u00a7', '\u03de', '\u03df', '\u03e8'], + t: ['\u0141', '\u0166', '\u0373'], + u: ['\u01b1', '\u054d'], + v: ['\u05d8'], + w: ['\u0428', '\u0460', '\u047c', '\u0d70'], + x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'], + y: ['\u00a5', '\u04b0', '\u04cb'], + z: ['\u01b5', '\u0240'], + }; + text.forEach(function(c) { + c = c.toLowerCase(); + var chars = trap[c] || [' ']; + var rand = Math.floor(Math.random() * chars.length); + if (typeof trap[c] !== 'undefined') { + result += trap[c][rand]; + } else { + result += c; + } + }); + return result; +}; + + +/***/ }), + +/***/ 7743: +/***/ ((module) => { + +// please no +module['exports'] = function zalgo(text, options) { + text = text || ' he is here '; + var soul = { + 'up': [ + '̍', '̎', '̄', '̅', + '̿', '̑', '̆', '̐', + '͒', '͗', '͑', '̇', + '̈', '̊', '͂', '̓', + '̈', '͊', '͋', '͌', + '̃', '̂', '̌', '͐', + '̀', '́', '̋', '̏', + '̒', '̓', '̔', '̽', + '̉', 'ͣ', 'ͤ', 'ͥ', + 'ͦ', 'ͧ', 'ͨ', 'ͩ', + 'ͪ', 'ͫ', 'ͬ', 'ͭ', + 'ͮ', 'ͯ', '̾', '͛', + '͆', '̚', + ], + 'down': [ + '̖', '̗', '̘', '̙', + '̜', '̝', '̞', '̟', + '̠', '̤', '̥', '̦', + '̩', '̪', '̫', '̬', + '̭', '̮', '̯', '̰', + '̱', '̲', '̳', '̹', + '̺', '̻', '̼', 'ͅ', + '͇', '͈', '͉', '͍', + '͎', '͓', '͔', '͕', + '͖', '͙', '͚', '̣', + ], + 'mid': [ + '̕', '̛', '̀', '́', + '͘', '̡', '̢', '̧', + '̨', '̴', '̵', '̶', + '͜', '͝', '͞', + '͟', '͠', '͢', '̸', + '̷', '͡', ' ҉', + ], + }; + var all = [].concat(soul.up, soul.down, soul.mid); + + function randomNumber(range) { + var r = Math.floor(Math.random() * range); + return r; + } + + function isChar(character) { + var bool = false; + all.filter(function(i) { + bool = (i === character); + }); + return bool; + } + + + function heComes(text, options) { + var result = ''; + var counts; + var l; + options = options || {}; + options['up'] = + typeof options['up'] !== 'undefined' ? options['up'] : true; + options['mid'] = + typeof options['mid'] !== 'undefined' ? options['mid'] : true; + options['down'] = + typeof options['down'] !== 'undefined' ? options['down'] : true; + options['size'] = + typeof options['size'] !== 'undefined' ? options['size'] : 'maxi'; + text = text.split(''); + for (l in text) { + if (isChar(l)) { + continue; + } + result = result + text[l]; + counts = {'up': 0, 'down': 0, 'mid': 0}; + switch (options.size) { + case 'mini': + counts.up = randomNumber(8); + counts.mid = randomNumber(2); + counts.down = randomNumber(8); + break; + case 'maxi': + counts.up = randomNumber(16) + 3; + counts.mid = randomNumber(4) + 1; + counts.down = randomNumber(64) + 3; + break; + default: + counts.up = randomNumber(8) + 1; + counts.mid = randomNumber(6) / 2; + counts.down = randomNumber(8) + 1; + break; + } + + var arr = ['up', 'mid', 'down']; + for (var d in arr) { + var index = arr[d]; + for (var i = 0; i <= counts[index]; i++) { + if (options[index]) { + result = result + soul[index][randomNumber(soul[index].length)]; + } + } + } + } + return result; + } + // don't summon him + return heComes(text, options); +}; + + + +/***/ }), + +/***/ 2857: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var colors = __nccwpck_require__(3595); + +module['exports'] = function() { + // + // Extends prototype of native string object to allow for "foo".red syntax + // + var addProperty = function(color, func) { + String.prototype.__defineGetter__(color, func); + }; + + addProperty('strip', function() { + return colors.strip(this); + }); + + addProperty('stripColors', function() { + return colors.strip(this); + }); + + addProperty('trap', function() { + return colors.trap(this); + }); + + addProperty('zalgo', function() { + return colors.zalgo(this); + }); + + addProperty('zebra', function() { + return colors.zebra(this); + }); + + addProperty('rainbow', function() { + return colors.rainbow(this); + }); + + addProperty('random', function() { + return colors.random(this); + }); + + addProperty('america', function() { + return colors.america(this); + }); + + // + // Iterate through all default styles and colors + // + var x = Object.keys(colors.styles); + x.forEach(function(style) { + addProperty(style, function() { + return colors.stylize(this, style); + }); + }); + + function applyTheme(theme) { + // + // Remark: This is a list of methods that exist + // on String that you should not overwrite. + // + var stringPrototypeBlacklist = [ + '__defineGetter__', '__defineSetter__', '__lookupGetter__', + '__lookupSetter__', 'charAt', 'constructor', 'hasOwnProperty', + 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', + 'valueOf', 'charCodeAt', 'indexOf', 'lastIndexOf', 'length', + 'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice', + 'split', 'substring', 'toLocaleLowerCase', 'toLocaleUpperCase', + 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', + ]; + + Object.keys(theme).forEach(function(prop) { + if (stringPrototypeBlacklist.indexOf(prop) !== -1) { + console.log('warn: '.red + ('String.prototype' + prop).magenta + + ' is probably something you don\'t want to override. ' + + 'Ignoring style name'); + } else { + if (typeof(theme[prop]) === 'string') { + colors[prop] = colors[theme[prop]]; + addProperty(prop, function() { + return colors[prop](this); + }); + } else { + var themePropApplicator = function(str) { + var ret = str || this; + for (var t = 0; t < theme[prop].length; t++) { + ret = colors[theme[prop][t]](ret); + } + return ret; + }; + addProperty(prop, themePropApplicator); + colors[prop] = function(str) { + return themePropApplicator(str); + }; + } + } + }); + } + + colors.setTheme = function(theme) { + if (typeof theme === 'string') { + console.log('colors.setTheme now only accepts an object, not a string. ' + + 'If you are trying to set a theme from a file, it is now your (the ' + + 'caller\'s) responsibility to require the file. The old syntax ' + + 'looked like colors.setTheme(__dirname + ' + + '\'/../themes/generic-logging.js\'); The new syntax looks like '+ + 'colors.setTheme(require(__dirname + ' + + '\'/../themes/generic-logging.js\'));'); + return; + } else { + applyTheme(theme); + } + }; +}; + + +/***/ }), + +/***/ 3045: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var colors = __nccwpck_require__(3595); +module['exports'] = colors; + +// Remark: By default, colors will add style properties to String.prototype. +// +// If you don't wish to extend String.prototype, you can do this instead and +// native String will not be touched: +// +// var colors = require('colors/safe); +// colors.red("foo") +// +// +__nccwpck_require__(2857)(); + + +/***/ }), + +/***/ 6936: +/***/ ((module) => { + +module['exports'] = function(colors) { + return function(letter, i, exploded) { + if (letter === ' ') return letter; + switch (i%3) { + case 0: return colors.red(letter); + case 1: return colors.white(letter); + case 2: return colors.blue(letter); + } + }; +}; + + +/***/ }), + +/***/ 5210: +/***/ ((module) => { + +module['exports'] = function(colors) { + // RoY G BiV + var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; + return function(letter, i, exploded) { + if (letter === ' ') { + return letter; + } else { + return colors[rainbowColors[i++ % rainbowColors.length]](letter); + } + }; +}; + + + +/***/ }), + +/***/ 3441: +/***/ ((module) => { + +module['exports'] = function(colors) { + var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', + 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed', + 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta']; + return function(letter, i, exploded) { + return letter === ' ' ? letter : + colors[ + available[Math.round(Math.random() * (available.length - 2))] + ](letter); + }; +}; + + +/***/ }), + +/***/ 2989: +/***/ ((module) => { + +module['exports'] = function(colors) { + return function(letter, i, exploded) { + return i % 2 === 0 ? letter : colors.inverse(letter); + }; +}; + + +/***/ }), + +/***/ 3104: +/***/ ((module) => { + +/* +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + +var styles = {}; +module['exports'] = styles; + +var codes = { + reset: [0, 0], + + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + grey: [90, 39], + + brightRed: [91, 39], + brightGreen: [92, 39], + brightYellow: [93, 39], + brightBlue: [94, 39], + brightMagenta: [95, 39], + brightCyan: [96, 39], + brightWhite: [97, 39], + + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + bgGray: [100, 49], + bgGrey: [100, 49], + + bgBrightRed: [101, 49], + bgBrightGreen: [102, 49], + bgBrightYellow: [103, 49], + bgBrightBlue: [104, 49], + bgBrightMagenta: [105, 49], + bgBrightCyan: [106, 49], + bgBrightWhite: [107, 49], + + // legacy styles for colors pre v1.0.0 + blackBG: [40, 49], + redBG: [41, 49], + greenBG: [42, 49], + yellowBG: [43, 49], + blueBG: [44, 49], + magentaBG: [45, 49], + cyanBG: [46, 49], + whiteBG: [47, 49], + +}; + +Object.keys(codes).forEach(function(key) { + var val = codes[key]; + var style = styles[key] = []; + style.open = '\u001b[' + val[0] + 'm'; + style.close = '\u001b[' + val[1] + 'm'; +}); + + +/***/ }), + +/***/ 223: +/***/ ((module) => { + +"use strict"; +/* +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + + + +module.exports = function(flag, argv) { + argv = argv || process.argv; + + var terminatorPos = argv.indexOf('--'); + var prefix = /^-{1,2}/.test(flag) ? '' : '--'; + var pos = argv.indexOf(prefix + flag); + + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; + + +/***/ }), + +/***/ 662: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/* +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + + + +var os = __nccwpck_require__(2037); +var hasFlag = __nccwpck_require__(223); + +var env = process.env; + +var forceColor = void 0; +if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') + || hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 + || parseInt(env.FORCE_COLOR, 10) !== 0; +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level: level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3, + }; +} + +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } + + if (hasFlag('color=16m') || hasFlag('color=full') + || hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (stream && !stream.isTTY && forceColor !== true) { + return 0; + } + + var min = forceColor ? 1 : 0; + + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first + // Windows release that supports 256 colors. Windows 10 build 14931 is the + // first release that supports 16m/TrueColor. + var osRelease = os.release().split('.'); + if (Number(process.versions.node.split('.')[0]) >= 8 + && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) { + return sign in env; + }) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0 + ); + } + + if ('TERM_PROGRAM' in env) { + var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Hyper': + return 3; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + if (env.TERM === 'dumb') { + return min; + } + + return min; +} + +function getSupportLevel(stream) { + var level = supportsColor(stream); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr), +}; + + /***/ }), /***/ 8932: @@ -32387,6 +33343,7 @@ const github = __nccwpck_require__(5438); const config = __nccwpck_require__(4570); const UZip = __nccwpck_require__(8222); +const colors = __nccwpck_require__(3045); function setOutput(summary, shareLink, conclusion) { core.setOutput("summary", summary); @@ -32394,6 +33351,18 @@ function setOutput(summary, shareLink, conclusion) { core.setOutput("conclusion", conclusion); } +function extractLink(markdownString) { + const regex = /\[.*?\]\((.*?)\)/g; + const urls = []; + let match; + + while ((match = regex.exec(markdownString)) !== null) { + urls.push(match[1]); + } + + return urls; +} + const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); (async function () { @@ -32406,6 +33375,9 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); const dispatchId = v4(); + console.log('TestDriver: "I can help ya test that!"'.green); + console.log('TestDriver: "Looking into it..."'.green); + await octokit.request( "POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", { @@ -32476,15 +33448,21 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); let workflowId; while (!workflowId) { await waitFor(1000 * 60); + console.log('TestDriver: "Setting Up..."'.green); workflowId = await findWorkFlow(); } return workflowId; }; + console.log('TestDriver: "I\'m workin on it!"'.green); + const workflowId = await waitUntilWorkflowAvailable(); - console.log("workflow found", workflowId); + console.log( + 'TestDriver: "I\'m all set up and ready to take this thing for a drive!"' + .green + ); const checkStatus = async () => { const workflow = await octokit.request( @@ -32502,10 +33480,13 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); }; }; + console.log('TestDriver: "Let\'s Go!"'.green); + const waitUntilComplete = async () => { let { status, conclusion } = await checkStatus(); while (status != "completed") { await waitFor(1000 * 60 * 1); + console.log('TestDriver: "Testing..."'.green); const resp = await checkStatus(); status = resp.status; conclusion = resp.conclusion; @@ -32516,7 +33497,9 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); const conclusion = await waitUntilComplete(); - console.log("completed with ", conclusion); + console.log('TestDriver: "Done!"'.green); + + console.log('TestDriver: "Writing my report..."'.green); // list workflow run artifacts const artifacts = await octokit.request( @@ -32536,6 +33519,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } } + console.log('TestDriver: "Interpreting results..."'.green); + // download the artifact let downloadedArtifact = await octokit.request( "GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}", @@ -32547,6 +33532,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } ); + console.log('TestDriver: "Decoding..."'.green); + // get file data let unzippedData = UZip.parse(downloadedArtifact.data); const textDecoder = new TextDecoder(); @@ -32559,8 +33546,17 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); core.setFailed(oiResult); } - console.log(shareLink, oiResult, conclusion); - setOutput(shareLink, oiResult, conclusion); + if (isPassed) { + console.log('TestDriver: "PASS"'.green); + } else { + console.log('TestDriver: "FAIL"'.red); + } + + console.log("View Test Results on Dashcam.io".yellow); + console.log(extractLink(shareLink)); + + console.log("TestDriver.ai Summary".yellow); + console.log(oiResult); })(); })(); diff --git a/package-lock.json b/package-lock.json index bac8a24..ff4289b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2,10 +2,218 @@ "requires": true, "lockfileVersion": 1, "dependencies": { + "@actions/core": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", + "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", + "requires": { + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" + }, + "dependencies": { + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + } + } + }, + "@actions/github": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", + "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", + "requires": { + "@actions/http-client": "^2.2.0", + "@octokit/core": "^5.0.1", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + } + }, + "@actions/http-client": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz", + "integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==", + "requires": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "@fastify/busboy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", + "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==" + }, + "@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==" + }, + "@octokit/core": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.1.0.tgz", + "integrity": "sha512-BDa2VAMLSh3otEiaMJ/3Y36GU4qf6GI+VivQ/P41NC6GHcdxpKlqV0ikSZ5gdQsmS3ojXeRx5vasgNTinF0Q4g==", + "requires": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.0.0", + "@octokit/request": "^8.0.2", + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^12.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/endpoint": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.4.tgz", + "integrity": "sha512-DWPLtr1Kz3tv8L0UvXTDP1fNwM0S+z6EJpRcvH66orY6Eld4XBMCSYsaWp4xIm61jTWxK68BrR7ibO+vSDnZqw==", + "requires": { + "@octokit/types": "^12.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/graphql": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.0.2.tgz", + "integrity": "sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==", + "requires": { + "@octokit/request": "^8.0.1", + "@octokit/types": "^12.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==" + }, + "@octokit/plugin-paginate-rest": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.0.tgz", + "integrity": "sha512-NKi0bJEZqOSbBLMv9kdAcuocpe05Q2xAXNLTGi0HN2GSMFJHNZuSoPNa0tcQFTOFCKe+ZaYBZ3lpXh1yxgUDCA==", + "requires": { + "@octokit/types": "^12.6.0" + } + }, + "@octokit/plugin-request-log": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.0.tgz", + "integrity": "sha512-2uJI1COtYCq8Z4yNSnM231TgH50bRkheQ9+aH8TnZanB6QilOnx8RMD2qsnamSOXtDj0ilxvevf5fGsBhBBzKA==" + }, + "@octokit/plugin-rest-endpoint-methods": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.0.tgz", + "integrity": "sha512-INw5rGXWlbv/p/VvQL63dhlXr38qYTHkQ5bANi9xofrF9OraqmjHsIGyenmjmul1JVRHpUlw5heFOj1UZLEolA==", + "requires": { + "@octokit/types": "^12.6.0" + } + }, + "@octokit/request": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.2.0.tgz", + "integrity": "sha512-exPif6x5uwLqv1N1irkLG1zZNJkOtj8bZxuVHd71U5Ftuxf2wGNvAJyNBcPbPC+EBzwYEbBDdSFb8EPcjpYxPQ==", + "requires": { + "@octokit/endpoint": "^9.0.0", + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^12.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/request-error": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.1.tgz", + "integrity": "sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==", + "requires": { + "@octokit/types": "^12.0.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "@octokit/rest": { + "version": "20.0.2", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-20.0.2.tgz", + "integrity": "sha512-Ux8NDgEraQ/DMAU1PlAohyfBBXDwhnX2j33Z1nJNziqAfHi70PuxkFYIcIt8aIAxtRE7KVuKp8lSR8pA0J5iOQ==", + "requires": { + "@octokit/core": "^5.0.0", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-request-log": "^4.0.0", + "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + } + }, + "@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "requires": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "@vercel/ncc": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz", + "integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==", + "dev": true + }, + "before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" + }, "colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + }, + "deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" + }, + "undici": { + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "requires": { + "@fastify/busboy": "^2.0.0" + } + }, + "universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==" + }, + "uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" + }, + "uzip": { + "version": "0.20201231.0", + "resolved": "https://registry.npmjs.org/uzip/-/uzip-0.20201231.0.tgz", + "integrity": "sha512-OZeJfZP+R0z9D6TmBgLq2LHzSSptGMGDGigGiEe0pr8UBe/7fdflgHlHBNDASTXB5jnFuxHpNaJywSg8YFeGng==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" } } } From 9cb1d2cc26c790b7536d5b31a60feb0fb8d93fca Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sun, 25 Feb 2024 10:35:08 -0600 Subject: [PATCH 07/11] update output --- action.yml | 5 ++++- src/index.js | 12 +++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index 1bd3e9a..2956987 100644 --- a/action.yml +++ b/action.yml @@ -18,9 +18,12 @@ outputs: summary: description: >- The summary of the test result - shareLink: + link: description: >- The share link of Dashcam.io recording + markdown: + description: >- + A hotlinked image of the Dashcam.io recording runs: using: node16 main: ./dist/index.js diff --git a/src/index.js b/src/index.js index f2221b6..81cdfee 100644 --- a/src/index.js +++ b/src/index.js @@ -5,12 +5,6 @@ import { v4 as uuidv4 } from "uuid"; const UZip = require("uzip"); const colors = require("colors"); -function setOutput(summary, shareLink, conclusion) { - core.setOutput("summary", summary); - core.setOutput("share-link", shareLink); - core.setOutput("conclusion", conclusion); -} - function extractLink(markdownString) { const regex = /\[.*?\]\((.*?)\)/g; const urls = []; @@ -35,8 +29,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); const dispatchId = uuidv4(); - console.log('TestDriver: "I can help ya test that!"'.green); console.log('TestDriver: "Looking into it..."'.green); + console.log('TestDriver: "I can help ya test that!"'.green); await octokit.request( "POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", @@ -217,4 +211,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); console.log("TestDriver.ai Summary".yellow); console.log(oiResult); + + core.setOutput("summary", oiResult); + core.setOutput("link", extractLink(shareLink)); + core.setOutput("markdown", shareLink); })(); From 76552f53b5ea249e82f9d9492e7f361c84666f60 Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sun, 25 Feb 2024 10:43:36 -0600 Subject: [PATCH 08/11] add summaries --- src/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/index.js b/src/index.js index 81cdfee..da7bc72 100644 --- a/src/index.js +++ b/src/index.js @@ -215,4 +215,14 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); core.setOutput("summary", oiResult); core.setOutput("link", extractLink(shareLink)); core.setOutput("markdown", shareLink); + + await core.summary + .addHeading("TestDriver.ai Results") + .addLink("View Dashcam.io Recording!", extractLink(shareLink)) + .addHeading("Summary") + .addRaw(oiResult) + .addEOL() + .addRaw(shareLink) + .addEOL() + .write(); })(); From c99f7b7ce559488a2de1f449d96fd2901da6e72e Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sun, 25 Feb 2024 10:48:07 -0600 Subject: [PATCH 09/11] update url parser --- src/index.js | 12 +++--------- test.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 test.js diff --git a/src/index.js b/src/index.js index da7bc72..92bdd5f 100644 --- a/src/index.js +++ b/src/index.js @@ -6,15 +6,9 @@ const UZip = require("uzip"); const colors = require("colors"); function extractLink(markdownString) { - const regex = /\[.*?\]\((.*?)\)/g; - const urls = []; - let match; - - while ((match = regex.exec(markdownString)) !== null) { - urls.push(match[1]); - } - - return urls; + const regex = /\[!\[.*?\]\(.*?\)\]\((.*?)\)/; + const match = markdown.match(regex); + return match[1]; } const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); diff --git a/test.js b/test.js new file mode 100644 index 0000000..11b8b88 --- /dev/null +++ b/test.js @@ -0,0 +1,11 @@ +const markdown = `[![slack - Slack - standups - Dashcam](https://replayable-api-production.herokuapp.com/replay/65d5543860e6e600640d2757/gif?shareKey=UQqPY2VywrcFPLZXSRsWaA)](https://app.dashcam.io/replay/65d5543860e6e600640d2757?share=UQqPY2VywrcFPLZXSRsWaA)`; + +const regex = /\[!\[.*?\]\(.*?\)\]\((.*?)\)/; +const match = markdown.match(regex); + +if (match) { + console.log(match); + console.log(match[1]); // This will log the URL you're looking for +} else { + console.log("No URL found"); +} From 746c24c1f5e7907ae70374cd669f10ec939f6a9d Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sun, 25 Feb 2024 13:07:46 -0600 Subject: [PATCH 10/11] package --- dist/index.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index 98b8005..785b38d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -33345,22 +33345,10 @@ const config = __nccwpck_require__(4570); const UZip = __nccwpck_require__(8222); const colors = __nccwpck_require__(3045); -function setOutput(summary, shareLink, conclusion) { - core.setOutput("summary", summary); - core.setOutput("share-link", shareLink); - core.setOutput("conclusion", conclusion); -} - function extractLink(markdownString) { - const regex = /\[.*?\]\((.*?)\)/g; - const urls = []; - let match; - - while ((match = regex.exec(markdownString)) !== null) { - urls.push(match[1]); - } - - return urls; + const regex = /\[!\[.*?\]\(.*?\)\]\((.*?)\)/; + const match = markdown.match(regex); + return match[1]; } const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); @@ -33375,8 +33363,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); const dispatchId = v4(); - console.log('TestDriver: "I can help ya test that!"'.green); console.log('TestDriver: "Looking into it..."'.green); + console.log('TestDriver: "I can help ya test that!"'.green); await octokit.request( "POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", @@ -33557,6 +33545,20 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); console.log("TestDriver.ai Summary".yellow); console.log(oiResult); + + core.setOutput("summary", oiResult); + core.setOutput("link", extractLink(shareLink)); + core.setOutput("markdown", shareLink); + + await core.summary + .addHeading("TestDriver.ai Results") + .addLink("View Dashcam.io Recording!", extractLink(shareLink)) + .addHeading("Summary") + .addRaw(oiResult) + .addEOL() + .addRaw(shareLink) + .addEOL() + .write(); })(); })(); From 5f15790e3aaedc950cc7c727e299025e85d8aecb Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sun, 25 Feb 2024 14:22:32 -0600 Subject: [PATCH 11/11] fix markdown --- dist/index.js | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 785b38d..f72571c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -33347,7 +33347,7 @@ const colors = __nccwpck_require__(3045); function extractLink(markdownString) { const regex = /\[!\[.*?\]\(.*?\)\]\((.*?)\)/; - const match = markdown.match(regex); + const match = markdownString.match(regex); return match[1]; } diff --git a/src/index.js b/src/index.js index 92bdd5f..199c551 100644 --- a/src/index.js +++ b/src/index.js @@ -7,7 +7,7 @@ const colors = require("colors"); function extractLink(markdownString) { const regex = /\[!\[.*?\]\(.*?\)\]\((.*?)\)/; - const match = markdown.match(regex); + const match = markdownString.match(regex); return match[1]; }