|
16 | 16 | ref: master |
17 | 17 | repository: ${{ github.repository }} |
18 | 18 | path: repos/cgns_doc |
19 | | - |
20 | | - - name: Checkout the CGNS source repository (master branch) |
21 | | - |
22 | | - with: |
23 | | - ref: master |
24 | | - repository: 'CGNS/CGNS' |
25 | | - path: repos/cgns_src |
26 | | - |
27 | | - - name: Get commit history for docs repository |
28 | | - id: get_commits_doc_repo |
29 | | - run: | |
30 | | - cd repos/cgns_doc |
31 | | - last_day=$(date -d 'yesterday' '+%Y-%m-%d') |
32 | | - first_commit_hash=$(git rev-list --max-count=1 --before="$last_day" HEAD) |
33 | | - echo "FIRST_COMMIT_HASH_DOC_REPO=$first_commit_hash" >> $GITHUB_OUTPUT |
34 | | -
|
35 | | - - name: Get commit history for source repository |
36 | | - id: get_commits_src_repo |
37 | | - run: | |
38 | | - cd repos/cgns_src |
39 | | - last_day=$(date -d 'yesterday' '+%Y-%m-%d') |
40 | | - first_commit_hash=$(git rev-list --max-count=1 --before="$last_day" HEAD) |
41 | | - echo "FIRST_COMMIT_HASH_SRC_REPO=$first_commit_hash" >> $GITHUB_OUTPUT |
42 | | -
|
43 | | - - name: Check if any commits exist in either repository |
44 | | - id: has_commits |
45 | | - run: | |
46 | | - if [[ -z "${{ steps.get_commits_doc_repo.outputs.FIRST_COMMIT_HASH_DOC_REPO }}" ]] && |
47 | | - [[ -z "${{ steps.get_commits_src_repo.outputs.FIRST_COMMIT_HASH_SRC_REPO }}" ]]; then |
48 | | - echo "HAS_COMMITS=false" >> $GITHUB_OUTPUT |
49 | | - else |
50 | | - echo "HAS_COMMITS=true" >> $GITHUB_OUTPUT |
51 | | - fi |
52 | | -
|
53 | | - - name: Log result and trigger another workflow |
54 | | - run: | |
55 | | - if [[ "${{ steps.has_commits.outputs.HAS_COMMITS }}" == "true" ]]; then |
56 | | - echo "Changes found in the previous day." |
57 | | - # Trigger another workflow |
58 | | - echo "::set-output name=trigger_next_workflow::true" |
59 | | - else |
60 | | - echo "No changes found in the previous day." |
61 | | - fi |
62 | | -sdfdsfsdf |
63 | | -# - name: Trigger downstream workflow (optional) |
64 | | -# uses: actions/github-script@v6 |
65 | | -# if: ${{ steps.log_result.outputs.trigger_next_workflow }} |
66 | | -# with: |
67 | | -# script: | |
68 | | -# github.actions.createWorkflowDispatch({ |
69 | | -# owner: 'CGNS', |
70 | | -# repo: 'cgns.github.io ', |
71 | | -# workflow_id: 'publish.yml', |
72 | | -# ref: ${{ github.ref }} |
73 | | -# }) |
0 commit comments