Test gh actions #36
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
name: Check crd and readme updates | |
on: | |
pull_request: | |
paths: | |
- "apis/**" | |
jobs: | |
file-updates: | |
name: Test file updates | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: run make commands | |
run: | | |
make generate && make manifests && make api-docs | |
- name: check git status | |
id: git_status | |
run : | | |
if [[ -n $(git status -s) ]] | |
then | |
echo "New files to commit available" | |
echo "is_files_to_commit_present=true" >> $GITHUB_OUTPUT | |
delim="" | |
crd_files_joined="" | |
files=$(git status --porcelain | egrep "apis|config" | cut -b4-) | |
for file in $files; do | |
crd_files_joined="$crd_files_joined$delim$file" | |
delim="," | |
done | |
echo "crd_files=$crd_files_joined" >> $GITHUB_OUTPUT | |
delim="" | |
docs_files_joined="" | |
files=$(git status --porcelain | egrep "docs/api-overview.md" | cut -b4-) | |
for file in $files; do | |
docs_files_joined="$docs_files_joined$delim$file" | |
delim="," | |
done | |
echo "docs_files=$docs_files_joined" >> $GITHUB_OUTPUT | |
else | |
echo "No new files to commit" | |
echo "is_files_to_commit_present=false" >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/github-script@v7 | |
if: ${{ steps.git_status.outputs.is_files_to_commit_present == 'true' }} | |
name: generate comments | |
with: | |
script: | | |
console.log(context) | |
var doc_files = ${{ steps.git_status.outputs.docs_files }} | |
console.log(doc_files) | |
# run: | | |
# echo ${{ steps.git_status.outputs.docs_files }} | |
# echo ${{ steps.git_status.outputs.crd_files }} | |
# exit 1 |