Skip to content

Commit

Permalink
add github action for checking if imagestreams are properly regenerated
Browse files Browse the repository at this point in the history
  • Loading branch information
zmiklank committed Mar 12, 2024
1 parent f960b08 commit 18821f9
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/check-imagestreams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Imagestreamfiles check
on:
issue_comment:
types:
- created

permissions:
contents: read

jobs:
check:
name: "Check imagestream generator generated files"
runs-on: ubuntu-20.04
if: |
github.event.issue.pull_request
&& (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]'))
&& contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association)
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Check imagestream files
id: check
shell: bash
run: |
sudo apt -y update && sudo apt install -y python3-yaml
git clone https://github.com/sclorg/ci-scripts.git ci-scripts
sha=$(git rev-parse HEAD)
result="success"
python ci-scripts/ocp-stream-generator/ocp-stream-generator/stream_generator.py
git diff --exit-code -- imagestreams || result="failure"
echo "result=$result" >> "$GITHUB_OUTPUT"
echo "sha=$sha" >> "$GITHUB_OUTPUT"
- name: Set final commit status
uses: myrotvorets/[email protected]
with:
status: ${{ steps.check.outputs.result }}
context: "Imagestream files check"
sha: ${{ steps.check.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
...

0 comments on commit 18821f9

Please sign in to comment.