File tree 2 files changed +84
-0
lines changed
.github/actions/get-workflow-run-id
2 files changed +84
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Get Workflow Run ID
2
+
3
+ Get the ID of the latest successful workflow run.
4
+
5
+ Accepts the following inputs:
6
+
7
+ * ` repository ` (Required) - The repository owner and name (e.g. ` spring-projects/spring-security ` ).
8
+ * ` workflow-id ` (Required) - The ID of the workflow or the workflow file name.
9
+
10
+ Produces the following output:
11
+
12
+ * ` run-id ` - The ID of the latest successful workflow run.
13
+
14
+ ## Installation
15
+
16
+ ``` yaml
17
+ - id : get-workflow-run-id
18
+ name : Get Workflow Run ID
19
+ uses : spring-io/spring-security-release-tools/.github/actions/get-workflow-run-id@v1
20
+ with :
21
+ repository : owner/repo
22
+ workflow-id : build-and-deploy.yml
23
+ ` ` `
24
+
25
+ ## Example Usage
26
+
27
+ ` ` ` yaml
28
+ name : Download Artifacts
29
+
30
+ on : push
31
+
32
+ permissions :
33
+ actions : read
34
+
35
+ jobs :
36
+ download-artifacts :
37
+ name : Download Artifacts
38
+ runs-on : ubuntu-latest
39
+ steps :
40
+ - id : get-workflow-run-id
41
+ name : Get Workflow Run ID
42
+ uses : spring-io/spring-security-release-tools/.github/actions/get-workflow-run-id@v1
43
+ with :
44
+ repository : spring-projects/spring-security
45
+ workflow-id : continuous-integration-workflow.yml
46
+ - name : Download Artifacts
47
+ uses : actions/download-artifact@v4
48
+ with :
49
+ name : maven-repository
50
+ path : build
51
+ repository : spring-projects/spring-security
52
+ github-token : ${{ github.token }}
53
+ run-id : ${{ steps.get-workflow-run-id.outputs.run-id }}
54
+ - name : Unzip Artifacts
55
+ run : pushd build && unzip maven-repository.zip && popd
56
+ ` ` `
Original file line number Diff line number Diff line change
1
+ name : ' Get Workflow Run ID'
2
+ description : ' Get the ID of the latest successful workflow run for a given workflow.'
3
+ author : ' sjohnr'
4
+
5
+ inputs :
6
+ repository :
7
+ description : ' The repository owner and name (e.g. spring-projects/spring-security).'
8
+ required : true
9
+ workflow-id :
10
+ description : ' The ID of the workflow or the workflow file name (e.g. build-and-deploy.yml).'
11
+ required : true
12
+
13
+ outputs :
14
+ run-id :
15
+ description : ' The ID of the latest successful workflow run.'
16
+ value : ${{ steps.get-workflow-run-id.outputs.run-id }}
17
+
18
+ runs :
19
+ using : ' composite'
20
+ steps :
21
+ - id : get-workflow-run-id
22
+ name : Get Workflow Run ID
23
+ shell : bash
24
+ env :
25
+ GH_TOKEN : ${{ github.token }}
26
+ run : |
27
+ runId=$(gh run list -R ${{ inputs.repository }} -w ${{ inputs.workflow-id }} -s success --json databaseId -q '.[0].databaseId')
28
+ echo "run-id=$runId" >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments