Skip to content

Commit

Permalink
use fkirc/skip-duplicate-actions@v5
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed Feb 1, 2025
1 parent 3857330 commit 4fd6442
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 70 deletions.
44 changes: 0 additions & 44 deletions .github/actions/check-previous-builds/action.yaml

This file was deleted.

46 changes: 20 additions & 26 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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
Expand Down

0 comments on commit 4fd6442

Please sign in to comment.