On Commit action #504
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: On Commit action | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
push: | |
branches: ["main"] | |
jobs: | |
get_base_commit: | |
runs-on: ubuntu-latest | |
outputs: | |
commit_number: ${{ steps.get_commits.outputs.commit_number }} | |
steps: | |
- name: get number of commits pushed | |
id: get_commits | |
env: | |
EVENT_COMMITS: ${{toJson(github.event.commits)}} | |
run: | | |
echo "$EVENT_COMMITS" > commits.json | |
tr -d '\n' < commits.json > commits_oneline.json | |
LL=$( jq '. | length' commits_oneline.json) | |
echo 'Number of commits pushed: $LL' | |
echo "commit_number=$LL" > $GITHUB_OUTPUT | |
verify_changes: | |
if: ${{github.event.schedule}} != "" | |
needs: get_base_commit | |
uses: ./.github/workflows/validate_code_style.yml | |
with: | |
reference_commit: "HEAD~${{needs.get_base_commit.outputs.commit_number}}" | |
build_samples: | |
uses: ./.github/workflows/samples_build.yml | |
build_and_run_tests: | |
uses: ./.github/workflows/run_tests.yml | |
Post_fail_to_Teams: | |
needs: [verify_changes, build_samples, build_and_run_tests] | |
if: ${{ failure() }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: neonidian/teams-notify-build-status@v4 | |
with: | |
webhookUrl: ${{ secrets.MSTEAMS_WEBHOOK }} | |
status: failure | |
message: On Commit tests failed! | |
env: | |
SHOULD_DISPLAY_ACTOR_LABEL: false | |
SHOULD_DISPLAY_VIEW_RUN_BUTTON: true | |
SHOULD_DISPLAY_VIEW_COMMIT_BUTTON: true | |
compare_configuration: | |
needs: [build_samples, build_and_run_tests, verify_changes] | |
uses: ./.github/workflows/compare_config.yml | |
with: | |
current_run_id: ${{ github.run_id }} | |
post_configuration_diff: | |
needs: [compare_configuration] | |
runs-on: ubuntu-latest | |
if: ${{ fromJson(needs.compare_configuration.outputs.diff_detected)}} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: configuration_diff | |
- uses: neonidian/teams-notify-build-status@v4 | |
name: Notify Teams | |
with: | |
webhookUrl: ${{ secrets.MSTEAMS_WEBHOOK }} | |
message: Detected change in .config ${{needs.compare_configuration.outputs.artifact_url}} | |
env: | |
SHOULD_DISPLAY_ACTOR_LABEL: false | |
SHOULD_DISPLAY_VIEW_RUN_BUTTON: true | |
SHOULD_DISPLAY_VIEW_COMMIT_BUTTON: false |