You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/08/13 11:22:01 UTC

[camel-quarkus] branch master updated: Avoid purging artifacts for builds that may be in progress

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f7f29b  Avoid purging artifacts for builds that may be in progress
6f7f29b is described below

commit 6f7f29b9b15a7e729bc0d2dc9667ab27482d5dcf
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Aug 13 10:05:48 2020 +0100

    Avoid purging artifacts for builds that may be in progress
---
 .github/workflows/purge-stale-artifacts-cron.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/purge-stale-artifacts-cron.yaml b/.github/workflows/purge-stale-artifacts-cron.yaml
index 697ebb9..07510e6 100644
--- a/.github/workflows/purge-stale-artifacts-cron.yaml
+++ b/.github/workflows/purge-stale-artifacts-cron.yaml
@@ -29,8 +29,9 @@ jobs:
     steps:
       - name: Purge Stale Artifacts
         run: |
+          TWELVE_HOURS_AGO="$(date --iso-8601=seconds -d "-12 hours" | cut -f1 -d'+')Z"
           ARTIFACTS=$(curl -s -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/artifacts)
-          for ID in $(echo ${ARTIFACTS} | jq '.artifacts[] | select (.expired == false and .name == "maven-repo") | .id'); do
+          for ID in $(echo ${ARTIFACTS} | jq --arg twelveHoursAgo ${TWELVE_HOURS_AGO} '.artifacts[] | select (.expired == false and .name == "maven-repo" and .created_at <= $twelveHoursAgo) | .id'); do
               echo "Deleting artifact ${ID} from ${GITHUB_REPOSITORY}"
               curl -s -X DELETE -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/artifacts/${ID}
               sleep 5