@@ -13,9 +13,14 @@ import (
1313	"gopkg.in/yaml.v3" 
1414)
1515
16- func  PinActions (inputYaml  string ) (string , bool , error ) {
16+ func  PinActions (inputYaml  string ,  exemptedActions  [] string ) (string , bool , error ) {
1717	workflow  :=  metadata.Workflow {}
1818	updated  :=  false 
19+ 	exemptedActionsMap  :=  make (map [string ]bool )
20+ 	for  _ , exemptedAction  :=  range  exemptedActions  {
21+ 		exemptedAction  =  strings .TrimRight (exemptedAction , "/" )
22+ 		exemptedActionsMap [exemptedAction ] =  true 
23+ 	}
1924	err  :=  yaml .Unmarshal ([]byte (inputYaml ), & workflow )
2025	if  err  !=  nil  {
2126		return  inputYaml , updated , fmt .Errorf ("unable to parse yaml %v" , err )
@@ -28,7 +33,7 @@ func PinActions(inputYaml string) (string, bool, error) {
2833		for  _ , step  :=  range  job .Steps  {
2934			if  len (step .Uses ) >  0  {
3035				localUpdated  :=  false 
31- 				out , localUpdated  =  PinAction (step .Uses , out )
36+ 				out , localUpdated  =  PinAction (step .Uses , out ,  exemptedActionsMap )
3237				updated  =  updated  ||  localUpdated 
3338			}
3439		}
@@ -37,7 +42,7 @@ func PinActions(inputYaml string) (string, bool, error) {
3742	return  out , updated , nil 
3843}
3944
40- func  PinAction (action , inputYaml  string ) (string , bool ) {
45+ func  PinAction (action , inputYaml  string ,  exemptedActionsMap   map [ string ] bool ) (string , bool ) {
4146
4247	updated  :=  false 
4348	if  ! strings .Contains (action , "@" ) ||  strings .HasPrefix (action , "docker://" ) {
@@ -50,6 +55,11 @@ func PinAction(action, inputYaml string) (string, bool) {
5055	leftOfAt  :=  strings .Split (action , "@" )
5156	tagOrBranch  :=  leftOfAt [1 ]
5257
58+ 	// skip pinning for exempted actions 
59+ 	if  exemptedActionsMap [leftOfAt [0 ]] {
60+ 		return  inputYaml , updated 
61+ 	}
62+ 
5363	splitOnSlash  :=  strings .Split (leftOfAt [0 ], "/" )
5464	owner  :=  splitOnSlash [0 ]
5565	repo  :=  splitOnSlash [1 ]
0 commit comments