Skip to content

Commit 0280943

Browse files
committed
Fixed some errors in the workflow
1 parent 30b1ee7 commit 0280943

File tree

4 files changed

+49
-64
lines changed

4 files changed

+49
-64
lines changed

.github/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ Executes on each (re-)opening of and on each new commit in a pull-request. First
7676
Then, it pushes the updated EA model back to the
7777
originating branch, automatically keeping the two manifestations of the model in synch.
7878
Finally, it generates a review-session file, uploads it to artifactory and post a message in the pull request
79-
containing conflict status and a link to the review session
79+
containing conflict status and a link to the review session.

.github/workflows/AutosarUmlActionExample.yml

Lines changed: 45 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ env:
1818
ModelName: counting-logic
1919
ModelExtension: qeax
2020
ReviewSessionURL: 'https://nexus.lieberlieber.com/repository/lemontree-session'
21-
LemonTreePipelineToolsRemovePrerenderedDiagramsExecutable: >-
22-
https://nexus.lieberlieber.com/repository/lemontree-pipeline-tools/LemonTree.Pipeline.Tools.RemovePrerenderedDiagrams.exe
21+
LemonTreePipelineToolsRemovePrerenderedDiagramsExecutable: https://nexus.lieberlieber.com/repository/lemontree-pipeline-tools/LemonTree.Pipeline.Tools.RemovePrerenderedDiagrams.exe
2322
jobs:
2423
AutosarUml:
2524
defaults:
@@ -28,16 +27,35 @@ jobs:
2827
runs-on: windows-latest
2928
timeout-minutes: 15
3029
steps:
31-
- uses: actions/checkout@v3
30+
- uses: actions/checkout@v4
3231
with:
32+
ref: ${{ github.event.pull_request.head.ref }}
3333
lfs: true
3434
fetch-depth: 0
35+
- uses: LieberLieber/setup-LemonTree.Automation@v1
36+
id: GetLTA
37+
with:
38+
License: '${{secrets.LTALICENSE}}'
39+
- name: Run IncQuery AUTOSAR-UML Bridge
40+
uses: IncQueryLabs/incquery-suite-bridge-autosar-uml-action@v1
41+
with:
42+
arxml_folder_path: example-arxml
43+
ea_model_file_path: 'counting-logic.qeax'
44+
incquery_username: '${{ secrets.INCQUERY_USERNAME }}'
45+
incquery_password: '${{ secrets.INCQUERY_PASSWORD }}'
46+
license: '${{ secrets.INCQUERY_AUTOSAR_UML_INTEGRATION_LICENSE }}'
47+
- name: Push updated model
48+
run: |
49+
git config --local user.name "Automatic Model Update"
50+
git config --local user.email "username@users.noreply.github.com"
51+
git add counting-logic.qeax
52+
git commit -m "Automatic Model Update"
53+
git push
3554
- name: Get relevant commit IDs
3655
id: CommitIds
37-
run: >
56+
run: |
3857
git fetch
39-
$baseId = git merge-base origin/$env:GITHUB_BASE_REF
40-
origin/$env:GITHUB_HEAD_REF
58+
$baseId = git merge-base origin/$env:GITHUB_BASE_REF origin/$env:GITHUB_HEAD_REF
4159
echo "::set-output name=baseCommitId::$baseId"
4260
$sourceId = git show-ref --hash origin/$env:GITHUB_HEAD_REF
4361
echo "::set-output name=sourceCommitId::$sourceId"
@@ -53,31 +71,27 @@ jobs:
5371
uses: actions/github-script@v6
5472
with:
5573
result-encoding: string
56-
script: >
74+
script: |
5775
const repoName = context.payload.pull_request.base.repo.name
5876
const prNumber = context.payload.pull_request.number
5977
const baseSHA = '${{steps.CommitIds.outputs.targetCommitId}}'
6078
const headSHA = '${{steps.CommitIds.outputs.sourceCommitId}}'
61-
const filename = [repoName, 'PR', prNumber, baseSHA,
62-
headSHA].join('-') + '.ltsfs'
79+
const filename = [repoName, 'PR', prNumber, baseSHA, headSHA].join('-') + '.ltsfs'
6380
console.log(`Filename will be: ${filename}`)
6481
return filename
6582
- name: Download base-commit file
6683
id: baseDownload
67-
run: >
84+
run: |
6885
git fetch origin ${{steps.CommitIds.outputs.baseCommitId}}
69-
$pointer = git cat-file blob
70-
${{steps.CommitIds.outputs.baseCommitId}}:${{env.ModelName}}.${{env.ModelExtension}}
71-
$sha = ($pointer[1] -split(":"))[1]
72-
if($sha -ne $null){
73-
$shaPart1 = $sha.Substring(0,2)
74-
$shaPart2 = $sha.Substring(2,2)
75-
echo "Model SHA: $sha"
76-
git cat-file --filters ${{steps.CommitIds.outputs.baseCommitId}}:${{env.ModelName}}.${{env.ModelExtension}} | Out-Null
77-
copy ".git\lfs\objects\$shaPart1\$shaPart2\$sha" "${{env.ModelName}}_base.${{env.ModelExtension}}"
86+
$contents = git cat-file blob ${{steps.CommitIds.outputs.baseCommitId}}:${{env.ModelName}}.${{env.ModelExtension}}
87+
echo $contents[1]
88+
if($contents -ne $null){
89+
echo "ps"
90+
$contents | Out-File -FilePath "${{env.ModelName}}_base.${{env.ModelExtension}}"
7891
echo "result=downloaded" >> $env:GITHUB_OUTPUT
7992
}
80-
else{
93+
else {
94+
echo "no"
8195
echo "result=notFound" >> $env:GITHUB_OUTPUT
8296
}
8397
- name: Post new model comment to PR
@@ -89,52 +103,23 @@ jobs:
89103
issue_number: context.issue.number,
90104
owner: context.repo.owner,
91105
repo: context.repo.repo,
92-
body: `Model not found on base commit / fork-off point`
106+
body: `Model not found on base commit or fork-off point`
93107
})
94-
- name: Download source branch head file
108+
- name: Download target file
95109
if: steps.baseDownload.outputs.result == 'downloaded'
96110
id: headDownload
97-
run: >
111+
run: |
98112
git fetch origin $env:GITHUB_HEAD_REF
99-
$pointer = git cat-file blob
100-
${{steps.CommitIds.outputs.sourceCommitId}}":${{env.ModelName}}.${{env.ModelExtension}}"
101-
$sha = ($pointer[1] -split(":"))[1]
102-
$shaPart1 = $sha.Substring(0,2)
103-
$shaPart2 = $sha.Substring(2,2)
104-
echo "Model SHA: $sha"
105-
git cat-file --filters
106-
${{steps.CommitIds.outputs.sourceCommitId}}":${{env.ModelName}}.${{env.ModelExtension}}"
107-
| Out-Null
108-
copy ".git\lfs\objects\$shaPart1\$shaPart2\$sha"
109-
"${{env.ModelName}}_head.${{env.ModelExtension}}"
110-
- uses: LieberLieber/setup-LemonTree.Automation@v1
111-
id: GetLTA
112-
with:
113-
License: '${{secrets.LTALICENSE}}'
114-
- name: Run IncQuery AUTOSAR-UML Bridge
115-
uses: IncQueryLabs/incquery-suite-bridge-autosar-uml-action@v1
116-
with:
117-
arxml_folder_path: example-arxml
118-
ea_model_file_path: 'counting-logic.qeax'
119-
incquery_username: '${{ secrets.INCQUERY_USERNAME }}'
120-
incquery_password: '${{ secrets.INCQUERY_PASSWORD }}'
121-
license: '${{ secrets.INCQUERY_AUTOSAR_UML_INTEGRATION_LICENSE }}'
122-
- name: Push updated model
123-
run: >
124-
git config --local user.name "Automatic Model Update"
125-
git config --local user.email "username@users.noreply.github.com"
126-
git add counting-logic.qeax
127-
git commit -m "Automatic Model Update"
128-
git push
113+
$pointer = git cat-file blob ${{steps.CommitIds.outputs.targetCommitId}}":${{env.ModelName}}.${{env.ModelExtension}}"
114+
$pointer | Out-File -FilePath "${{env.ModelName}}_target.${{env.ModelExtension}}"
129115
- name: Check for merge conflicts
130116
if: steps.baseDownload.outputs.result == 'downloaded'
131117
id: mergeCheck
132-
run: >
133-
&"${{steps.GetLTA.outputs.LemonTreeAutomationExecutable}}" merge
134-
--base ${{env.ModelName}}_base.${{env.ModelExtension}} --theirs
135-
${{env.ModelName}}.${{env.ModelExtension}} --mine
136-
${{env.ModelName}}_head.${{env.ModelExtension}} --dryrun --sfs ${{
137-
steps.session_file.outputs.result }} --abortOnConflict true
118+
run: |
119+
Test-Path ${{env.ModelName}}_base.${{env.ModelExtension}}
120+
Test-Path ${{env.ModelName}}_target.${{env.ModelExtension}}
121+
Test-Path ${{env.ModelName}}.${{env.ModelExtension}}
122+
&"${{steps.GetLTA.outputs.LemonTreeAutomationExecutable}}" merge --base ${{env.ModelName}}_base.${{env.ModelExtension}} --theirs ${{env.ModelName}}_target.${{env.ModelExtension}} --mine ${{env.ModelName}}.${{env.ModelExtension}} --dryrun --sfs ${{ steps.session_file.outputs.result }} --abortOnConflict true
138123
echo "::set-output name=result::$LASTEXITCODE"
139124
echo "Return code: $LASTEXITCODE"
140125
if($LASTEXITCODE -eq 0){
@@ -164,7 +149,7 @@ jobs:
164149
$mergecheckresult = ${{ steps.mergeCheck.outputs.result}}
165150
if ($mergecheckresult -eq 0)
166151
{
167-
$output = &'${{steps.GetLTA.outputs.LemonTreeAutomationExecutable}}' diff --theirs ${{env.ModelName}}_base.${{env.ModelExtension}} --mine ${{env.ModelName}}_head.${{env.ModelExtension}} --sfs ${{ steps.session_file.outputs.result }}
152+
$output = &'${{steps.GetLTA.outputs.LemonTreeAutomationExecutable}}' diff --theirs ${{env.ModelName}}_target.${{env.ModelExtension}} --mine ${{env.ModelName}}.${{env.ModelExtension}} --sfs ${{ steps.session_file.outputs.result }}
168153
echo $output
169154
ForEach ($line in $($output -split "`r`n"))
170155
{

.github/workflows/ConsistencyCheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) Robert Bosch GmbH
1+
# Copyright (c) LieberLieber Software GmbH
22
# This Source Code Form is subject to the terms of the Mozilla Public
33
# License, v. 2.0. If a copy of the MPL was not distributed with this
44
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

DemoModel.eapx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:fc2849e1110c73d344148c05deaeac1bc9571713b5ca4ce9a38d64ca6ada1679
3-
size 3047424
2+
oid sha256:98c6345d391555e5b6de83e9391a9cff60a0dd0ed538ad82db7f01ac3aa53480
3+
size 3055616

0 commit comments

Comments
 (0)