-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add github action for checking if imagestreams are properly regenerated
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
... |