|
5 | 5 | branches: [ master, qa ] |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - needTest: |
| 8 | + check-files: |
| 9 | + if: ${{ github.event_name == 'pull_request' }} |
9 | 10 | runs-on: ubuntu-latest |
10 | 11 | outputs: |
11 | | - canSkip: ${{ steps.checkFiles.outputs.canSkip }} |
| 12 | + canSkip: ${{ steps.Checker.outputs.canSkip }} |
12 | 13 | steps: |
13 | | - - name: Check files in PR |
14 | | - id: checkFiles |
15 | | - run: | |
16 | | - PR_FILES_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{github.event.pull_request.number}}/files" |
17 | | - FILES_CHANGED=$(curl -s -X GET -G $PR_FILES_URL | jq -r '.[] | .filename') |
18 | | - echo $FILES_CHANGED |
19 | | - if [ ${#FILES_CHANGED[@]} == 1 ] && [ ${FILES_CHANGED[0]} == README.adoc ]; then |
20 | | - echo "Test can be skipped because only updated README.adoc" |
21 | | - echo "::set-output name=canSkip::true" |
22 | | - else |
23 | | - echo "Need to run test" |
24 | | - echo "::set-output name=canSkip::false" |
25 | | - fi |
26 | | -
|
27 | | - java8build: |
| 14 | + - name: Get files |
| 15 | + uses: actions/checkout@v2 |
| 16 | + - name: Get tools |
| 17 | + uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + path: tools/ |
| 20 | + repository: openliberty/guides-common |
| 21 | + - id: Checker |
| 22 | + shell: bash |
| 23 | + run: bash ./tools/pr-checker/checker.sh ${{ github.repository }} ${{ github.event.pull_request.number }} | tee checker.log |
| 24 | + - id: Lint-Code-Base |
| 25 | + if: always() |
| 26 | + uses: github/super-linter@v3 |
| 27 | + env: |
| 28 | + VALIDATE_ALL_CODEBASE: false |
| 29 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + LINTER_RULES_PATH: ./tools/pr-checker/linters/ |
| 31 | + - name: Summary |
| 32 | + if: always() |
| 33 | + run: | |
| 34 | + cat ./checker.log | tail -n +2; echo "====== Super Linter ======" |
| 35 | + cat ./super-linter.log | sed -n '/.*The script has completed.*/,$p' | tail -n +4 | sed 's/.*\(\[[A-Z]\+\]\)/\1/' |
| 36 | + echo "====== Examine logs in Checker and Super-Linter steps for more details ======" |
| 37 | + if [ '${{ steps.Checker.outcome }}' != 'success' ] || [ '${{ steps.Lint-Code-Base.outcome }}' != 'success' ]; then exit 1; fi |
| 38 | + test-app: |
28 | 39 | runs-on: ubuntu-latest |
29 | | - needs: [needTest] |
30 | | - if: "!contains(needs.needTest.outputs.canSkip, 'true')" |
| 40 | + needs: [check-files] |
| 41 | + if: "!contains(needs.check-files.outputs.canSkip, 'true')" |
31 | 42 | defaults: |
32 | 43 | run: |
33 | 44 | working-directory: finish |
|
0 commit comments