Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is generator: add composite action for checking generated files #121

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions ocp-stream-generator/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Imagestreamfiles check
description: "Check imagestream generator generated files"

inputs:
ref:
description: ref of the PR
required: true

runs:
using: composite
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Clone ci-script repo, install deps
shell: bash
id: sha
run: |
cd imagestreams/
git clone https://github.com/sclorg/ci-scripts.git ci-scripts
sudo apt -y update && sudo apt install -y python3-yaml
sha=$(git rev-parse HEAD)
echo "sha=$sha" >> "$GITHUB_OUTPUT"

- name: Check imagestream files
id: check
shell: bash
run: |
result="success"
python ci-scripts/ocp-stream-generator/ocp-stream-generator/stream_generator.py imagestreams.yaml
git diff --exit-code -- imagestreams || result="failure"
echo "result=$result" >> "$GITHUB_OUTPUT"

- name: Set final commit status
uses: myrotvorets/[email protected]
with:
status: ${{ steps.check.outputs.result }}
context: "Imagestream files check"
sha: ${{ steps.sha.outputs.sha }}

- name: Exit on ERR
shell: bash
run: |
_result=${{ steps.check.outputs.result }}
if [ "$_result" == failure ]; then
git show -s -- imagestreams
echo "::error::Imagestream files are not regenerated properly."
echo "::warning::Please use 'sclorg/ci-scripts/ocp-stream-generator'"
echo "::warning::to regenerate them."
exit 1
fi
...
Loading