Skip to content

Commit 5965ed1

Browse files
authored
Merge pull request #28 from dreadnode/ads/eng-323-bug-regression-in-robopages-workflow-validation-failures
fix: fix regression in continue on error
2 parents dffac33 + 2e01869 commit 5965ed1

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

.github/workflows/validate_robopages.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727

2828
- name: Validate Contribution Files
2929
id: robopages-validation
30-
continue-on-error: true
3130
run: |
3231
validate_file() {
3332
local file="$1"
3433
local tmp_file="/tmp/$(basename $file)"
34+
local validation_status=0
3535
3636
if [[ ! "$file" =~ ^([a-zA-Z0-9_\-]+/)*[a-zA-Z0-9_\-]+\.yml$ ]]; then
3737
echo "Invalid file path characters: $file"
@@ -54,34 +54,45 @@ jobs:
5454
5555
docker pull dreadnode/robopages:latest
5656
57-
# Run validation with Docker socket mounted using temp file
57+
# Run validation and capture the exit status
5858
docker run --rm \
5959
-v $(pwd):/workspace \
6060
-v /var/run/docker.sock:/var/run/docker.sock \
6161
-v "$tmp_file:/workspace/$(basename $file)" \
6262
-w /workspace \
6363
--privileged \
64-
dreadnode/robopages:latest validate --path "$(basename $file)" --skip-docker
64+
dreadnode/robopages:latest validate --path "$(basename $file)" --skip-docker || validation_status=$?
6565
6666
rm "$tmp_file"
67+
return $validation_status
6768
}
6869
70+
# Initialize overall status
71+
overall_status=0
72+
6973
# Get changed files using GitHub's provided variables
7074
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | \
7175
grep '\.yml$' | grep -v '^.github/' || true)
7276
7377
# Validate each changed file
7478
for file in $changed_files; do
7579
echo "Validating $file..."
76-
validate_file "$file" || exit 1
80+
if ! validate_file "$file"; then
81+
overall_status=1
82+
echo "::error::Validation failed for $file"
83+
fi
7784
done
7885
86+
exit $overall_status
87+
7988
- name: Post validation status
8089
if: always()
8190
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #7.0.1
8291
with:
8392
script: |
84-
const validation_status = '${{ steps.robopages-validation.outcome }}' === 'success' ? '✅ Validation successful' : '❌ Validation failed';
93+
const validation_status = process.env.STATE_validation === '0'
94+
? '✅ Validation successful'
95+
: '❌ Validation failed';
8596
const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
8697
const timestamp = new Date().toISOString();
8798
const body = [
@@ -91,17 +102,16 @@ jobs:
91102
'',
92103
'Please ensure your contribution follows the required format.',
93104
'',
94-
`🔍 [View Full Validation Details](${runUrl})`,
105+
`[View Full Validation Details](${runUrl})`,
95106
'',
96107
'---',
97108
`Run ID: \`${process.env.GITHUB_RUN_ID}\``,
98109
`Workflow: ${process.env.GITHUB_WORKFLOW}`
99110
].join('\n');
100111
101-
github.rest.pulls.createReview({
112+
github.rest.issues.createComment({
102113
owner: context.repo.owner,
103114
repo: context.repo.repo,
104-
pull_number: context.issue.number,
105-
body: body,
106-
event: 'COMMENT'
115+
issue_number: context.issue.number,
116+
body: body
107117
});

0 commit comments

Comments
 (0)