Normal PR1 #9
This file contains hidden or 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-Readme-Structure | |
on: | |
pull_request_target: | |
types: [opened, synchronize, edited] | |
jobs: | |
readme_structure: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create GitHub App Token | |
id: app-token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ vars.GH_APP_ID }} | |
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} | |
owner: ${{ github.repository_owner }} | |
- name: Checkout code repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.repository }} | |
token: ${{ steps.app-token.outputs.token }} | |
path: 'projects' | |
- name: Checkout tools repository | |
uses: actions/checkout@v4 | |
with: | |
repository: SiliconLabsSoftware/aep_ci_tools | |
ref: 'hop_dev' | |
token: ${{ steps.app-token.outputs.token }} | |
path: 'aep_ci_tools' | |
- name: Check the changes | |
id: pr_check | |
run: | | |
cd projects | |
bash ${{ github.workspace }}/aep_ci_tools/scripts/check_pr_changes.sh \ | |
${{ github.base_ref }} ${{ github.event.pull_request.number }} \ | |
${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.base.sha }} | |
echo ==Changes files:== | |
cat git_diff.txt | |
if [ ! -s changed_projects_folder.txt ]; then | |
echo "has_changes=false" >> $GITHUB_OUTPUT | |
echo "===> No project changes detected...........Skipped" | |
exit 0 | |
fi | |
echo "has_changes=true" >> $GITHUB_OUTPUT | |
echo ==Changed projects:== | |
cat changed_projects_folder.txt | |
- name: Run test | |
if: ${{ steps.pr_check.outputs.has_changes == 'true' }} | |
run : | | |
cd projects | |
bash ${{ github.workspace }}/aep_ci_tools/scripts/check_readme_file_v2.sh \ | |
changed_projects_folder.txt > readme_file_report.html | |
- name: Upload Result | |
if: ${{ steps.pr_check.outputs.has_changes == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: readme_file_report | |
path: projects/readme_file_report.html | |
retention-days: 90 | |
- name: Check log file to set status of the job | |
if: ${{ steps.pr_check.outputs.has_changes == 'true' }} | |
run: | | |
cd projects | |
if grep -qe "FAILURE" readme_file_report.html; then | |
echo ======================================= | |
echo "Result: Failure" | |
echo "Check report at the step: Upload Result" | |
echo ======================================= | |
exit 1 | |
else | |
echo "Result: Success" | |
fi |