Skip to content

Commit 67dffd1

Browse files
authored
Merge pull request #4 from JohT/feature/use-public-reuseable-code-graph-analysis-workflow
Use public reuseable graph analysis workflow
2 parents 40f2a0c + 510fe45 commit 67dffd1

File tree

4 files changed

+124
-100
lines changed

4 files changed

+124
-100
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Commit Results
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
commit-author-name:
7+
description: "The display name of the commit author"
8+
required: false
9+
type: string
10+
default: '${{ github.event.repository.name }} Continuous Integration'
11+
commit-author-email:
12+
description: "The email address of the commit author"
13+
required: true
14+
type: string
15+
commit-message:
16+
description: "The commit message"
17+
required: false
18+
type: string
19+
default: "ci: Add automated results"
20+
commit-directory:
21+
description: "The directory to commit"
22+
required: true
23+
type: string
24+
uploaded-artifact-name:
25+
description: "The name of the uploaded artifact"
26+
required: true
27+
type: string
28+
secrets:
29+
repository-commit-token:
30+
description: "The token to use for committing to the repository"
31+
required: true
32+
33+
jobs:
34+
commit-results:
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Checkout GIT Repository
39+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
40+
with:
41+
token: ${{ secrets.repository-commit-token }}
42+
43+
- name: Download artifacts to commit
44+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
45+
with:
46+
name: ${{ inputs.uploaded-artifact-name }}
47+
path: ${{ inputs.commit-directory }}
48+
49+
- name: Display environment variable "github.event_name"
50+
run: echo "github.event_name=${{ github.event_name }}"
51+
52+
- name: Prepare commit of changes in `${{ inputs.commit-directory }}`
53+
run: |
54+
git config --global user.name '${{ inputs.commit-author-name }}'
55+
git config --global user.email '${{ inputs.commit-author-email }}'
56+
git config --local http.postBuffer 524288000
57+
git fetch origin
58+
git status
59+
git add ${{ inputs.commit-directory }}
60+
git status
61+
62+
- name: Commit and push changes in `${{ inputs.commit-directory }}`
63+
# Only run when a pull request gets merged or a commit is pushed to the main branch
64+
if: github.event_name == 'push'
65+
run: |
66+
git commit --message "${{ inputs.commit-message }}"
67+
git status
68+
git rebase --strategy-option=theirs origin/main --verbose
69+
git status
70+
git add ${{ inputs.commit-directory }}
71+
git status
72+
git push --verbose

.github/workflows/java-code-analysis.yml

Lines changed: 21 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,19 @@ on:
3838

3939
jobs:
4040
prepare-code-to-analyze:
41+
name: Prepare Code to Analyze
4142
runs-on: ubuntu-latest
42-
outputs:
43-
analysis-name: ${{ steps.set-analysis-name.outputs.analysis-name }}
44-
sources-upload-name: ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
45-
artifacts-upload-name: ${{ steps.set-artifacts-upload-name.outputs.artifacts-upload-name }}
46-
4743
env:
4844
PROJECT_NAME: AxonFramework
4945
# Version variable names matches renovate.json configuration entry
5046
AXON_FRAMEWORK_VERSION: 4.10.3
5147
# Java is in this example only used to download JARs for analysis using Maven
5248
JAVA_VERSION: 21
49+
outputs:
50+
project-name: ${{ env.PROJECT_NAME }}
51+
analysis-name: ${{ steps.set-analysis-name.outputs.analysis-name }}
52+
sources-upload-name: ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
53+
artifacts-upload-name: ${{ steps.set-artifacts-upload-name.outputs.artifacts-upload-name }}
5354

5455
steps:
5556
- name: (Prepare Code to Analyze) Checkout AxonFramework repository
@@ -98,6 +99,7 @@ jobs:
9899
with:
99100
name: ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
100101
path: ./source
102+
include-hidden-files: true
101103
if-no-files-found: error
102104
retention-days: 1
103105

@@ -112,57 +114,25 @@ jobs:
112114

113115

114116
analyze-code-graph:
117+
name: Analyze Code Graph
115118
needs: [prepare-code-to-analyze]
116-
uses: ./.github/workflows/analyze-code-graph.yml
119+
uses: JohT/code-graph-analysis-pipeline/.github/workflows/public-analyze-code-graph.yml@7f43cf96d676f715cf278b020ce1dbb3338f900b # v2
117120
with:
118121
analysis-name: ${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
119122
artifacts-upload-name: ${{ needs.prepare-code-to-analyze.outputs.artifacts-upload-name }}
120123
sources-upload-name: ${{ needs.prepare-code-to-analyze.outputs.sources-upload-name }}
124+
ref: 7f43cf96d676f715cf278b020ce1dbb3338f900b
121125

122126

123-
analysis-results:
127+
commit-analysis-results:
128+
name: Commit Analysis Results
124129
needs: [prepare-code-to-analyze, analyze-code-graph]
125-
runs-on: ubuntu-latest
126-
127-
env:
128-
CI_COMMIT_MESSAGE: Automated code structure analysis analysis-results (CI)
129-
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
130-
131-
steps:
132-
- name: Checkout GIT Repository
133-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
134-
with:
135-
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
136-
137-
- name: (Code Analysis Setup) Download source code and artifacts for analysis
138-
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
139-
with:
140-
name: ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }}
141-
path: analysis-results/${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
142-
143-
# Commit and push the native image agent analysis-results
144-
- name: Display environment variable "github.event_name"
145-
run: echo "github.event_name=${{ github.event_name }}"
146-
- name: Display changes in the "analysis-results" directory and prepare commit
147-
# Only run when a pull request gets merged or a commit is pushed to the main branch
148-
# git add parameters need to match paths-ignore parameters above
149-
# Git pull before add/commit/push to reduce race conditions on parallel builds
150-
run: |
151-
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
152-
git config --global user.email "7671054+JohT@users.noreply.github.com"
153-
git config --local http.postBuffer 524288000
154-
git fetch origin
155-
git status
156-
git add analysis-results
157-
git status
158-
- name: Commit and push changes in the "analysis-results" directory
159-
# Only run when a pull request gets merged or a commit is pushed to the main branch
160-
# git add parameters need to match paths-ignore parameters above
161-
# Git pull before add/commit/push to reduce race conditions on parallel builds
162-
if: github.event_name == 'push'
163-
run: |
164-
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
165-
git status
166-
git rebase --strategy-option=theirs origin/main --verbose
167-
git status
168-
git push --verbose
130+
uses: ./.github/workflows/internal-commit-results.yml
131+
with:
132+
commit-author-name: "${{ github.event.repository.name }} Continuous Integration"
133+
commit-author-email: "7671054+JohT@users.noreply.github.com"
134+
commit-message: "Automated code structure analysis results (CI)"
135+
commit-directory: "analysis-results/${{ needs.prepare-code-to-analyze.outputs.project-name }}/${{ needs.prepare-code-to-analyze.outputs.analysis-name }}"
136+
uploaded-artifact-name: ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }}
137+
secrets:
138+
repository-commit-token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}

.github/workflows/typescript-code-analysis.yml

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ on:
3838

3939
jobs:
4040
prepare-code-to-analyze:
41+
name: Prepare Code to Analyze
4142
runs-on: ubuntu-latest
4243
outputs:
44+
project-name: ${{ env.PROJECT_NAME }}
4345
analysis-name: ${{ steps.set-analysis-name.outputs.analysis-name }}
4446
sources-upload-name: ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
4547

@@ -79,61 +81,30 @@ jobs:
7981
with:
8082
name: ${{ steps.set-sources-upload-name.outputs.sources-upload-name }}
8183
path: .
84+
include-hidden-files: true
8285
if-no-files-found: error
8386
retention-days: 1
8487

8588

8689
analyze-code-graph:
90+
name: Analyze Code Graph
8791
needs: [prepare-code-to-analyze]
88-
uses: ./.github/workflows/analyze-code-graph.yml
92+
uses: JohT/code-graph-analysis-pipeline/.github/workflows/public-analyze-code-graph.yml@7f43cf96d676f715cf278b020ce1dbb3338f900b # v2
8993
with:
9094
analysis-name: ${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
9195
sources-upload-name: ${{ needs.prepare-code-to-analyze.outputs.sources-upload-name }}
96+
ref: 7f43cf96d676f715cf278b020ce1dbb3338f900b
9297

9398

94-
analysis-results:
99+
commit-analysis-results:
100+
name: Commit Analysis Results
95101
needs: [prepare-code-to-analyze, analyze-code-graph]
96-
runs-on: ubuntu-latest
97-
98-
env:
99-
CI_COMMIT_MESSAGE: Automated code structure analysis analysis-results (CI)
100-
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
101-
102-
steps:
103-
- name: Checkout GIT Repository
104-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
105-
with:
106-
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
107-
108-
- name: (Code Analysis Setup) Download source code and artifacts for analysis
109-
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
110-
with:
111-
name: ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }}
112-
path: analysis-results/${{ needs.prepare-code-to-analyze.outputs.analysis-name }}
113-
114-
# Commit and push the native image agent analysis-results
115-
- name: Display environment variable "github.event_name"
116-
run: echo "github.event_name=${{ github.event_name }}"
117-
- name: Display changes in the "analysis-results" directory and prepare commit
118-
# Only run when a pull request gets merged or a commit is pushed to the main branch
119-
# git add parameters need to match paths-ignore parameters above
120-
# Git pull before add/commit/push to reduce race conditions on parallel builds
121-
run: |
122-
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
123-
git config --global user.email "7671054+JohT@users.noreply.github.com"
124-
git config --local http.postBuffer 524288000
125-
git fetch origin
126-
git status
127-
git add analysis-results
128-
git status
129-
- name: Commit and push changes in the "analysis-results" directory
130-
# Only run when a pull request gets merged or a commit is pushed to the main branch
131-
# git add parameters need to match paths-ignore parameters above
132-
# Git pull before add/commit/push to reduce race conditions on parallel builds
133-
if: github.event_name == 'push'
134-
run: |
135-
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
136-
git status
137-
git rebase --strategy-option=theirs origin/main --verbose
138-
git status
139-
git push --verbose
102+
uses: ./.github/workflows/internal-commit-results.yml
103+
with:
104+
commit-author-name: "${{ github.event.repository.name }} Continuous Integration"
105+
commit-author-email: "7671054+JohT@users.noreply.github.com"
106+
commit-message: "Automated code structure analysis results (CI)"
107+
commit-directory: "analysis-results/${{ needs.prepare-code-to-analyze.outputs.project-name }}/${{ needs.prepare-code-to-analyze.outputs.analysis-name }}"
108+
uploaded-artifact-name: ${{ needs.analyze-code-graph.outputs.uploaded-analysis-results }}
109+
secrets:
110+
repository-commit-token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}

renovate.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
],
1212
"ignoreUnstable": false,
1313
"packageRules": [
14+
{
15+
"description": "Code Graph Analysis Pipeline Workflow",
16+
"groupName": [
17+
"Code Graph Analysis Pipeline Workflow"
18+
],
19+
"matchSourceUrls": [
20+
"https://github.com/JohT/code-graph-analysis-pipeline"
21+
],
22+
"matchUpdateTypes": [
23+
"digest"
24+
]
25+
}
1426
],
1527
"customManagers": [
1628
{
@@ -95,16 +107,15 @@
95107
"extractVersionTemplate": "^(?<version>\\d+).*$"
96108
},
97109
{
98-
"description": "Update code-graph-analysis-pipeline repository commit hash",
110+
"description": "Update code-graph-analysis-pipeline ref parameter",
99111
"customType": "regex",
100112
"fileMatch": [
101113
"(^|/)(workflow-templates|\\.(?:github|gitea|forgejo)/(?:workflows|actions))/.+\\.ya?ml$",
102114
"(^|/)action\\.ya?ml$"
103115
],
104116
"matchStringsStrategy": "combination",
105117
"matchStrings": [
106-
"uses: actions/checkout@v*\\s",
107-
"repository:\\s*JohT/code-graph-analysis-pipeline\\s",
118+
"uses: JohT/code-graph-analysis-pipeline/.github/workflows/public-analyze-code-graph.yml*\\s*",
108119
"ref:\\s*(?<currentDigest>.*?)\\s"
109120
],
110121
"packageNameTemplate": "https://github.com/JohT/code-graph-analysis-pipeline",

0 commit comments

Comments
 (0)