diff --git a/.github/actions/check-previous-builds/action.yaml b/.github/actions/check-previous-builds/action.yaml deleted file mode 100644 index febf1454..00000000 --- a/.github/actions/check-previous-builds/action.yaml +++ /dev/null @@ -1,44 +0,0 @@ -name: check for successful workflow runs for the same commit -description: uses the GitHub REST API to check whether a successful workflow run for the same commit already exists - -inputs: - githubToken: - description: "github token" - required: true - # TODO this also needs the id/name of the actual workflow - -runs: - using: "composite" - steps: - - name: list successful builds - id: list_successful_builds - uses: octokit/request-action@v2.x - with: - # https://docs.github.com/en/rest/actions/workflow-runs - route: GET /repos/${{ github.repository }}/actions/runs?head_sha=${{ github.sha }}&status=success - env: - GITHUB_TOKEN: ${{ inputs.githubToken }} - - # TODO remove this debug output - - run: "echo successful builds: '${{ steps.list_successful_builds.outputs.data }}'" - - - name: process Github API response - id: successful_builds_for_same_commit_exist - run: | - export number_of_successful_builds=${{ fromJson(steps.list_successful_builds.outputs.data).total_count }} - if [[ $number_of_successful_builds -gt 0 ]]; then - echo "result=true" >> $GITHUB_OUTPUT - else - echo "result=false" >> $GITHUB_OUTPUT - fi - - # TODO remove this debug output - - run: "echo has successful builds: '${{ steps.successful_builds_for_same_commit_exist.outputs.result }}'" - - # TODO write to output - -outputs: - successful-build-exists: - description: "whether a successful workflow run exists for the same commit" - value: ${{ steps.successful_builds_for_same_commit_exist.outputs.result }} - diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 945079c3..57f80f96 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,37 +27,31 @@ concurrency: cancel-in-progress: ${{ !(github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/')) }} jobs: + check_for_existing_previous_builds: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 - check_for_successful_builds_for_same_commit: - name: Check for successful builds for the same commit + echo_previous_builds_result: + needs: check_for_existing_previous_builds runs-on: ubuntu-latest steps: - - name: list successful builds - id: list_successful_builds - uses: octokit/request-action@v2.x - with: - route: GET /repos/${{ github.repository }}/actions/runs - head_sha: ${{ github.sha }} - status: success - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: "echo successful builds: '${{ steps.list_successful_builds.outputs.data }}'" - - name: process Github API response - id: successful_builds_for_same_commit_exist - run: | - export number_of_successful_builds=${{ fromJson(steps.list_successful_builds.outputs.data).total_count }} - if [[ $number_of_successful_builds -gt 0 ]]; then - echo "result=true" >> $GITHUB_OUTPUT - else - echo "result=false" >> $GITHUB_OUTPUT - fi - - run: "echo has successful builds: '${{ steps.successful_builds_for_same_commit_exist.outputs.result }}'" - - - separate_job: + - run: | + echo "should_skip : ${{needs.check_for_existing_previous_builds.outputs.should_skip}}" + echo "reason : ${{needs.check_for_existing_previous_builds.outputs.reason}}" + echo "skipped_by : ${{needs.check_for_existing_previous_builds.outputs.skipped_by}}" + echo "paths_result : ${{needs.check_for_existing_previous_builds.outputs.paths_result}}" + echo "changed_files: ${{needs.check_for_existing_previous_builds.outputs.changed_files}}" + + actual_job: + needs: check_for_existing_previous_builds + if: needs.check_for_existing_previous_builds.outputs.should_skip != 'true' runs-on: ubuntu-latest steps: - - run: "echo separate step, has successful builds: '${{ steps.successful_builds_for_same_commit_exist.outputs.result }}'" + - run: echo "Running slow tests..." && sleep 30 # verify: # name: Build & Test