Skip to content

Commit

Permalink
fix clear workflow runs ci
Browse files Browse the repository at this point in the history
  • Loading branch information
hydazz committed Aug 1, 2021
1 parent 93edc39 commit bd2fabf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Test the Docker Image
run: |
export TEST_SEARCH="Starting dashboard web server on port 6052"
curl -sSL https://raw.githubusercontent.com/hydazz/docker-utils/main/docker/docker-ci.sh | bash
curl -sSL https://raw.githubusercontent.com/hydazz/docker-utils/main/scripts/docker-ci.sh | bash
- name: Build and Push the Docker Image
run: |
Expand All @@ -66,7 +66,7 @@ jobs:
- name: Get New Package Versions From Image
run: |
docker run --rm --entrypoint /bin/sh -v ${PWD}:/tmp vcxpz/ci-build:ci-build -c '\
wget -q -O - https://raw.githubusercontent.com/hydazz/docker-utils/main/docker/package_versioner.sh | bash'
wget -q -O - https://raw.githubusercontent.com/hydazz/docker-utils/main/scripts/package_versioner.sh | bash'
- name: Commit and Push Changes to Github
run: |
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/clear-workflow-runs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@ jobs:
- uses: actions/checkout@v2

- name: Clear all workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ secrets.TOKEN }}
repository: ${{ github.repository }}
retain_days: 1
env:
TOKEN: ${{ secrets.TOKEN }}
run: |
echo "${TOKEN}" | gh auth login --with-token
runs=$(gh api repos/hydazz/docker-esphome/actions/runs | jq -r .total_count)
while true; do
if [[ $(gh api repos/hydazz/docker-esphome/actions/runs | jq -r .total_count) -gt 2 ]]; then
gh api repos/hydazz/docker-esphome/actions/runs \
--paginate -q '.workflow_runs[] | "\(.id)"' | \
xargs -n1 -I % gh api repos/hydazz/docker-esphome/actions/runs/% -X DELETE || true
else
exit 0
fi
done

0 comments on commit bd2fabf

Please sign in to comment.