-
Couldn't load subscription status.
- Fork 51
use actioncommit map for pining #2540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sailikhith-stepsecurity
merged 3 commits into
step-security:int
from
vamshi-stepsecurity:feat/pin-using-action-commit-map
Oct 21, 2025
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,6 +239,21 @@ func TestPinActions(t *testing.T) { | |
| } | ||
| }) | ||
|
|
||
| httpmock.RegisterResponder("GET", "https://api.github.com/repos/peter-evans-test/close-issue/commits/v1", | ||
| httpmock.NewStringResponder(200, `a700eac5bf2a1c7a8cb6da0c13f93ed96fd53dbe`)) | ||
|
|
||
| httpmock.RegisterResponder("GET", "https://api.github.com/repos/peter-evans-test/close-issue/git/matching-refs/tags/v1.", | ||
| httpmock.NewStringResponder(200, | ||
| `[ | ||
| { | ||
| "ref": "refs/tags/v1.0.4", | ||
| "object": { | ||
| "sha": "a700eac5bf2a1c7a8cb6da0c13f93ed96fd53vam", | ||
| "type": "commit" | ||
| } | ||
| } | ||
| ]`)) | ||
|
|
||
| // Mock manifest endpoints for specific versions and commit hashes | ||
| manifestResponders := []string{ | ||
| // the following list will contain the list of actions with versions | ||
|
|
@@ -296,15 +311,29 @@ func TestPinActions(t *testing.T) { | |
| {fileName: "exemptaction.yml", wantUpdated: true, exemptedActions: []string{"actions/checkout", "rohith/*"}, pinToImmutable: true}, | ||
| {fileName: "donotpintoimmutable.yml", wantUpdated: true, pinToImmutable: false}, | ||
| {fileName: "invertedcommas.yml", wantUpdated: true, pinToImmutable: false}, | ||
| {fileName: "pinusingmap.yml", wantUpdated: true, pinToImmutable: true}, | ||
| } | ||
| for _, tt := range tests { | ||
|
|
||
| var output string | ||
| var gotUpdated bool | ||
| var err error | ||
| var actionCommitMap map[string]string | ||
|
|
||
| input, err := ioutil.ReadFile(path.Join(inputDirectory, tt.fileName)) | ||
|
|
||
| if err != nil { | ||
| log.Fatal(err) | ||
| } | ||
|
|
||
| output, gotUpdated, err := PinActions(string(input), tt.exemptedActions, tt.pinToImmutable) | ||
| if tt.fileName == "pinusingmap.yml" { | ||
| actionCommitMap = map[string]string{ | ||
| "peter-evans-test/close-issue@v1": "peter-evans-test/close-issue@a700eac5bf2a1c7a8cb6da0c13f93ed96fd53vam", | ||
| "peter-check/[email protected]": "peter-check/close-issue@a700eac5bf2a1c7a8cb6da0c13f93ed96fd53tom", | ||
| } | ||
| } | ||
|
|
||
| output, gotUpdated, err = PinActions(string(input), tt.exemptedActions, tt.pinToImmutable, actionCommitMap) | ||
| if tt.wantUpdated != gotUpdated { | ||
| t.Errorf("test failed wantUpdated %v did not match gotUpdated %v", tt.wantUpdated, gotUpdated) | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: "close issue" | ||
|
|
||
| on: | ||
| push: | ||
|
|
||
|
|
||
| jobs: | ||
| closeissue: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Close Issue | ||
| uses: peter-evans-test/close-issue@v1 | ||
| with: | ||
| issue-number: 1 | ||
| comment: Auto-closing issue | ||
|
|
||
| - name: Close Issue | ||
| uses: peter-evans/close-issue@v1 | ||
| with: | ||
| issue-number: 1 | ||
| comment: Auto-closing issue | ||
|
|
||
| - name: Close Issue | ||
| uses: peter-check/[email protected] | ||
| with: | ||
| issue-number: 1 | ||
| comment: Auto-closing issue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: "close issue" | ||
|
|
||
| on: | ||
| push: | ||
|
|
||
|
|
||
| jobs: | ||
| closeissue: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Close Issue | ||
| uses: peter-evans-test/close-issue@a700eac5bf2a1c7a8cb6da0c13f93ed96fd53vam # v1.0.4 | ||
| with: | ||
| issue-number: 1 | ||
| comment: Auto-closing issue | ||
|
|
||
| - name: Close Issue | ||
| uses: peter-evans/close-issue@a700eac5bf2a1c7a8cb6da0c13f93ed96fd53dbe # v1.0.3 | ||
| with: | ||
| issue-number: 1 | ||
| comment: Auto-closing issue | ||
|
|
||
| - name: Close Issue | ||
| uses: peter-check/close-issue@a700eac5bf2a1c7a8cb6da0c13f93ed96fd53tom # v1.2.3 | ||
| with: | ||
| issue-number: 1 | ||
| comment: Auto-closing issue |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are GitHub Action references case sensitive? If not, this will not work in case the action is referenced in different case (e.g., actionorg/actionname@v2 and ActionOrg/Actionname@v2 will be treated differently in the current appraoch). If GitHub Action references are case insensitive, we should create a struct and perform case insensitive comparison on action name and/or version tag or use lowercase to create the map and look up operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes they are case sensitive @ashishkurmi
mkdocs/mkdocs#3567
https://github.com/orgs/community/discussions/27086
only secret names are are case insensitive