Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nightly cleanup #14

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/_deb_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ jobs:
deb_builder_tag=$(echo ${{inputs.base-tag}} | tr : - | tr / -)
case "${{ inputs.pull-request }}" in
true)
rti_license_file=${{ github.workspace }}/src/uno/rti_license.dat
rti_license_file=src/uno/rti_license.dat
base_image=ghcr.io/mentalsmash/uno-ci-base-tester:${deb_builder_tag}
;;
false)
rti_license_file=${{ github.workspace }}/src/uno-ci/docker/base-tester/resource/rti/rti_license.dat
rti_license_file=src/uno-ci/docker/base-tester/resource/rti/rti_license.dat
base_image=${{ inputs.base-tag }}
;;
esac
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
env:
DEB_TESTER: ${{ needs.config.outputs.TEST_IMAGE }}
FIX_DIR: ${{ github.workspace }}
RTI_LICENSE_FILE: ${{ needs.config.outputs.RTI_LICENSE_FILE }}
RTI_LICENSE_FILE: ${{ github.workspace }}/${{ needs.config.outputs.RTI_LICENSE_FILE }}
TEST_DATE: ${{ needs.config.outputs.TEST_DATE }}
TEST_ID: ${{ needs.config.outputs.TEST_ID }}
TEST_IMAGE: ${{ needs.config.outputs.TEST_IMAGE }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/pull_request_closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ permissions:
jobs:
cleanup_jobs:
runs-on: ubuntu-latest
# Run automatically only if the PR is from this repository,
# otherwise it won't be authorized to delete workflow runs.
# (suggested by https://github.com/orgs/community/discussions/25217)
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Clone uno
uses: actions/checkout@v4
Expand All @@ -55,8 +59,6 @@ jobs:
-N ${{ github.event_name == 'pull_request' && github.event.pull_request.number || inputs.pr-number }} \
${{ (github.event_name == 'pull_request' && github.event.pull_request.merged || inputs.pr-merged) && '-m' || '' }}
env:
# Changes to actions (e.g. delete workflow runs) require a PAT, and don't work with the GITHUB_TOKEN
# see https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#delete-a-workflow-run
GH_TOKEN: ${{ secrets.UNO_CI_ADMIN_PAT }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ADMIN_IMAGE: ghcr.io/mentalsmash/uno-ci-admin:latest

50 changes: 50 additions & 0 deletions .github/workflows/release_cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release (Cleanup)
run-name: |
release cleanup [${{github.ref_type == 'tag' && 'stable' || 'nightly' }}, ${{github.ref_name}}]

on:
workflow_dispatch:

workflow_run:
workflows: ["Release"]
types: [completed]

concurrency:
group: release-cleanup-${{ github.ref }}
cancel-in-progress: false

permissions:
actions: write
packages: read

jobs:
cleanup_jobs:
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- name: Clone uno
uses: actions/checkout@v4
with:
path: src/uno
submodules: true

- name: Log in to GitHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Clean up workflow runs"
run: |
docker run --rm \
-v $(pwd):/workspace \
-e GH_TOKEN=${GH_TOKEN} \
-w /workspace \
${ADMIN_IMAGE} \
src/uno/scripts/ci-admin nightly-cleanup \
-r ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ADMIN_IMAGE: ghcr.io/mentalsmash/uno-ci-admin:latest

Loading