Skip to content
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: 6 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# actionlint doesn't yet understand the `$/` self-repository `uses:` syntax.
# See https://github.com/rhysd/actionlint/issues/711.
paths:
.github/workflows/**:
ignore:
- 'reusable workflow call "\$/[^"]*" at "uses" is not following the format "owner/repo/path/to/workflow.yml@ref" nor "./path/to/workflow.yml"'
15 changes: 6 additions & 9 deletions .github/workflows/close-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ jobs:
cleanup:
name: Cleanup from previous test runs
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Delete previous test release
env:
GH_TOKEN: ${{ github.token }}
run: gh release delete vtest-${{ github.ref_name }} --cleanup-tag -y || echo "No previous release to delete"
uses: $/.github/workflows/workflow-cleanup-test-release.yml
permissions:
contents: write
with:
pr-number: ${{ github.event.pull_request.number }}
ref-name: ${{ github.event.pull_request.head.ref }}
16 changes: 6 additions & 10 deletions .github/workflows/test-app-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ permissions:
jobs:
cleanup:
name: Cleanup from previous test runs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Delete previous test release
env:
GH_TOKEN: ${{ github.token }}
run: gh release delete vtest-${{ github.ref_name }} --cleanup-tag -y || echo "No previous release to delete"
uses: $/.github/workflows/workflow-cleanup-test-release.yml
permissions:
contents: write
with:
ref-name: ${{ github.ref_name }}

test:
uses: ./.github/workflows/workflow-build.yml
uses: $/.github/workflows/workflow-build.yml
with:
app-name: "test_app"
build-type: ${{ github.event.inputs['build-type'] || 'release' }}
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/workflow-cleanup-test-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Cleanup Test Release

on:
workflow_call:
inputs:
ref-name:
description: "The ref name to clean up (e.g. main or 89/merge)"
required: false
type: string
default: ""
pr-number:
description: "The pull request number to clean up"
required: false
type: number

permissions:
contents: write

jobs:
cleanup:
name: Cleanup test releases
runs-on: ubuntu-latest
steps:
- name: Delete test releases
env:
GH_TOKEN: ${{ github.token }}
INPUT_REF_NAME: ${{ inputs['ref-name'] }}
INPUT_PR_NUMBER: ${{ inputs['pr-number'] }}
GITHUB_REF_NAME: ${{ github.ref_name }}
REPO: ${{ github.repository }}
run: |
echo "INPUT_REF_NAME='$INPUT_REF_NAME'"
echo "INPUT_PR_NUMBER='$INPUT_PR_NUMBER'"
echo "GITHUB_REF_NAME='$GITHUB_REF_NAME'"
echo "REPO='$REPO'"

TARGETS=()

if [ -n "$INPUT_REF_NAME" ]; then
TARGETS+=("vtest-$INPUT_REF_NAME")
fi

if [[ "$INPUT_PR_NUMBER" =~ ^[1-9][0-9]*$ ]]; then
TARGETS+=("vtest-$INPUT_PR_NUMBER/merge")
fi

if [ ${#TARGETS[@]} -eq 0 ]; then
TARGETS+=("vtest-$GITHUB_REF_NAME")
fi

echo "Resolved TARGETS=(${TARGETS[*]})"

for target in "${TARGETS[@]}"; do
echo "Searching releases for target: $target..."
export TARGET="$target"
RELEASE_IDS=$(gh api --paginate "repos/$REPO/releases?per_page=100" \
--jq '.[] | select(.tag_name == env.TARGET or .name == ("馃敄 " + env.TARGET)) | .id')

if [ -n "$RELEASE_IDS" ]; then
echo "Found release ID(s) for $target: $RELEASE_IDS"
for id in $RELEASE_IDS; do
echo "Deleting release $id ($target)..."
gh api -X DELETE "repos/$REPO/releases/$id"
echo "Successfully deleted release $id"
done
else
echo "No previous release found for $target"
fi
done
Loading