Skip to content

Commit 6c4031a

Browse files
authored
Adding version comment to the info, can be used to find mismatch between version number and comment (devops-actions#116)
1 parent f056c6e commit 6c4031a

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

README.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Used for inserting data into the [internal actions marketplace](https://github.c
1212
Minimal uses expression to use this action:
1313

1414
``` yaml
15-
uses: devops-actions/load-used-actions@v1.0.0
15+
uses: devops-actions/load-used-actions@v1.3.6
1616
with:
1717
PAT: ${{ secrets.GITHUB_TOKEN }} # use an Access Token with correct permissions to view private repos if you need to
1818
```
@@ -33,7 +33,7 @@ jobs:
3333
load-all-used-actions:
3434
runs-on: ubuntu-latest
3535
steps:
36-
- uses: devops-actions/load-used-actions@v1.0.0
36+
- uses: devops-actions/load-used-actions@v1.3.6
3737
name: Load used actions
3838
id: load-actions
3939
with:
@@ -44,7 +44,7 @@ jobs:
4444
run: cat ${{ steps.load-actions.outputs.actions-file }}
4545
4646
- name: Upload result file as artefact
47-
uses: actions/upload-artifact@v2
47+
uses: actions/upload-artifact@v4
4848
with:
4949
name: actions-file
5050
path: ${{ steps.load-actions.outputs.actions-file }}
@@ -65,7 +65,15 @@ actions-file: path to file containing compressed json string with all the action
6565
"workflows": [
6666
{
6767
"repo": "rajbos/actions-marketplace",
68-
"workflowFileName": "build-image.yml"
68+
"workflowFileName": "build-image.yml",
69+
"actionRef": "v3" # the 'version' of the reference being used, if any
70+
"actionVersionComment": null # the comment after the version, if any
71+
},
72+
{
73+
"repo": "rajbos/actions-marketplace",
74+
"workflowFileName": "build-image.yml",
75+
"actionRef": "6167776d96bd5da05da534aa9cea6d7c786c1c5a", # the 'version' of the reference being used, if any
76+
"actionVersionComment": "v3" # the comment after the 'version', if any
6977
},
7078
{ "etc" : "--" }
7179
]
@@ -83,3 +91,5 @@ The workflow object has the following properties:
8391
|----|-----------|
8492
|repo|The name of the repository that uses the action|
8593
|workflowFileName|The name of the workflow file that was found in the directory `.github/workflows/`|
94+
|actionRef| The 'version' of the reference being used, if any|
95+
|actionVersionComment| The comment after the version', if any|

Src/PowerShell/load-used-actions.ps1

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ function GetActionsFromWorkflow {
4848
$splitted = $uses.Split("@")
4949
$actionLink = $splitted[0]
5050
$actionRef = $splitted[1]
51+
$actionVersionComment = $splitted[2]
5152

5253
$data = [PSCustomObject]@{
5354
actionLink = $actionLink
5455
actionRef = $actionRef
55-
workflowFileName = $workflowFileName
56+
actionVersionComment = $actionVersionComment
57+
workflowFileName = $workflowFileName
5658
repo = $repo
5759
type = "action"
5860
}
@@ -69,10 +71,12 @@ function GetActionsFromWorkflow {
6971
$splitted = $uses.Split("@")
7072
$actionLink = $splitted[0]
7173
$actionRef = $splitted[1]
74+
$actionVersionComment = $splitted[2]
7275

7376
$data = [PSCustomObject]@{
7477
actionLink = $actionLink
7578
actionRef = $actionRef
79+
actionVersionComment = $actionVersionComment
7680
workflowFileName = $workflowFileName
7781
repo = $repo
7882
type = "reusable workflow"
@@ -160,6 +164,7 @@ function SummarizeActionsUsed {
160164
repo = $action.repo
161165
workflowFileName = $action.workflowFileName
162166
actionRef = $action.actionRef
167+
actionVersionComment = $action.actionVersionComment
163168
}
164169

165170
$found.workflows += $newInfo
@@ -176,6 +181,7 @@ function SummarizeActionsUsed {
176181
repo = $action.repo
177182
workflowFileName = $action.workflowFileName
178183
actionRef = $action.actionRef
184+
actionVersionComment = $action.actionVersionComment
179185
}
180186
)
181187
}

0 commit comments

Comments
 (0)