@@ -13,8 +13,8 @@ describe("enforce-pr-target workflow", () => {
1313 assert . match ( workflow , / p u l l _ r e q u e s t _ t a r g e t : / ) ;
1414 assert . doesNotMatch (
1515 workflow ,
16- / a c t i o n s \/ c h e c k o u t @ / ,
17- "wrong-branch enforcer must not check out untrusted PR code" ,
16+ / r e f : \s * \$ \{ \{ \s * g i t h u b \. e v e n t \. p u l l _ r e q u e s t \. h e a d / ,
17+ "enforcer must not check out untrusted PR head code" ,
1818 ) ;
1919 } ) ;
2020
@@ -43,4 +43,21 @@ describe("enforce-pr-target workflow", () => {
4343 assert . match ( workflow , / r e a d y C o n v e r s i o n F a i l e d / ) ;
4444 assert . match ( workflow , / C o u l d n o t m a r k p u l l r e q u e s t r e a d y f o r r e v i e w / ) ;
4545 } ) ;
46+
47+ it ( "listens for synchronize so rebase can clear ancestry failures" , ( ) => {
48+ assert . match ( workflow , / s y n c h r o n i z e / ) ;
49+ } ) ;
50+
51+ it ( "checks out trusted default-branch scripts only (never PR head)" , ( ) => {
52+ assert . match ( workflow , / a c t i o n s \/ c h e c k o u t @ [ 0 - 9 a - f ] { 40 } / ) ;
53+ assert . match ( workflow , / r e f : \s * \$ \{ \{ \s * g i t h u b \. e v e n t \. r e p o s i t o r y \. d e f a u l t _ b r a n c h \s * \} \} / ) ;
54+ assert . match ( workflow , / s p a r s e - c h e c k o u t : \s * \. g i t h u b \/ s c r i p t s / ) ;
55+ assert . match ( workflow , / p e r s i s t - c r e d e n t i a l s : \s * f a l s e / ) ;
56+ assert . doesNotMatch ( workflow , / r e f : \s * \$ \{ \{ \s * g i t h u b \. e v e n t \. p u l l _ r e q u e s t \. h e a d / ) ;
57+ } ) ;
58+
59+ it ( "loads pr-quality via require from the checked-out scripts" , ( ) => {
60+ assert . match ( workflow , / p r - q u a l i t y \. c j s / ) ;
61+ assert . match ( workflow , / c o l l e c t P r Q u a l i t y F a i l u r e s / ) ;
62+ } ) ;
4663} ) ;
0 commit comments