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
39 changes: 14 additions & 25 deletions .github/workflows/NewUpdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
timeout-minutes: 90
steps:
- name: checkout repo
uses: actions/checkout@v3.1.0
uses: actions/checkout@v6
- name: Download latest generators
run: |
mkdir .updater/openapi_generator
cd .updater/openapi_generator
wget -nv https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.10.0/openapi-generator-cli-7.10.0.jar -O openapi-generator-cli-7.10.jar
wget -nv https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.16.0/openapi-generator-cli-7.16.0.jar -O openapi-generator-cli-7.16.jar
- name: Download SIRIUS Release
uses: nick-fields/retry@v2
uses: nick-fields/retry@v4
with:
max_attempts: 5
timeout_minutes: 5
Expand Down Expand Up @@ -144,18 +144,14 @@ jobs:
ls ./.github/workflows
echo "Done"
- name: update file and push to remote
uses: stefanzweifel/git-auto-commit-action@v4.15.2
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: Auto-Updated OpenAPI Clients
- name: Run RManualGeneration
run: |
gh workflow run RManualGeneration.yml --ref ${GITHUB_REF##*/}
echo "dispatched workflow"
echo "sleeping for 30s to make sure it started"
sleep 30
id=$(gh run list --workflow RManualGeneration.yml --branch ${GITHUB_REF##*/} --json databaseId,status --jq '.[] | select(.status=="in_progress") | .databaseId')
id=$(gh workflow run RManualGeneration.yml --ref ${GITHUB_REF##*/} | grep -oP '(?<=runs/)\d+')
echo "run ID of RManualGeneration is: $id"
gh run watch $id --exit-status --interval 3
gh run watch $id --exit-status --interval 10
echo "generation done!"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -173,25 +169,18 @@ jobs:
- name: lock pull request
continue-on-error: true
id: lockpull
uses: sudo-bot/action-pull-request-lock@v1.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{steps.open-pr.outputs.pr_number}}
lock-reason: resolved
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api -X PUT repos/${{ github.repository }}/issues/${{steps.open-pr.outputs.pr_number}}/lock \
-f lock_reason=resolved
- name: Run tests if no changes occure
if: steps.lockpull.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version=$(cat .updater/api/packageVersion.txt)
echo "Running RunTests workflow with SIRIUS version: $version"
gh workflow run RunTests.yml --ref ${GITHUB_REF##*/} -f sirius_version="$version"
echo "sleeping for 30min before temp branch removal"
sleep 1800
# if: steps.lockpull.outcome == 'failure'
- name: Delete temp branches if no changes occure
if: steps.lockpull.outcome == 'failure'
uses: dawidd6/action-delete-branch@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
prefix: temp_
soft_fail: true
id=$(gh workflow run RunTests.yml --ref ${GITHUB_REF##*/} -f sirius_version="$version" | grep -oP '(?<=runs/)\d+')
echo "run ID of RunTests is: $id"
gh run watch $id --exit-status --interval 10
4 changes: 2 additions & 2 deletions .github/workflows/PythonTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:
SIRIUS_USER: ${{ secrets.SIRIUS_USER }}
SIRIUS_PW: ${{ secrets.SIRIUS_PW }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/RManualGeneration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ jobs:
matrix:
r-version: ["4.5"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- name: Set up R ${{ matrix.r-version }}
# TODO keep an eye out for Node.js 24 update
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
Expand Down Expand Up @@ -50,6 +51,6 @@ jobs:
run: roxygen2::roxygenize("client-api_r/generated", roclets = NULL, load_code = NULL, clean = TRUE)
shell: Rscript {0}
- name: update files and push to remote
uses: stefanzweifel/git-auto-commit-action@v4.15.2
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: Auto-Generated RSirius Manual
3 changes: 2 additions & 1 deletion .github/workflows/RTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ jobs:
SIRIUS_USER: ${{ secrets.SIRIUS_USER }}
SIRIUS_PW: ${{ secrets.SIRIUS_PW }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- name: Set up R ${{ matrix.r-version }}
# TODO keep an eye out for Node.js 24 update
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/SetupBranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Call NewUpdate
run: |
if [ -n "${{ inputs.sirius_version }}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/VersionTagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
TagRelease:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- name: Check for Release
id: "check_release"
run: |
Expand Down
47 changes: 46 additions & 1 deletion .github/workflows/updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
target_branch: ${{ steps.setup.outputs.target_branch }}
steps:
- name: checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Call SetupBranch
id: setup
run: |
Expand All @@ -28,5 +28,50 @@ jobs:
else
gh workflow run SetupBranch.yml --ref ${GITHUB_REF##*/} -f target_branch=$target_branch
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CleanupTempBranch:
needs: UpdateOnNewBranch
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: checkout repo
uses: actions/checkout@v6
- name: Wait for NewUpdate to finish on temp branch
run: |
sleep 60
id=$(gh run list --workflow NewUpdate.yml --branch ${{ needs.UpdateOnNewBranch.outputs.target_branch }} --json databaseId,status \
--jq '.[] | select(.status=="in_progress" or .status=="queued") | .databaseId' | head -n1)
echo "Watching run ID: $id"
gh run watch $id --exit-status --interval 10
- name: Delete temp branch if no changes occurred
run: |
target_branch="${{ needs.UpdateOnNewBranch.outputs.target_branch }}"

# Safety: must be a temp_ branch
if [[ ! "$target_branch" == temp_* ]]; then
echo "Not a temp_ branch, skipping deletion"
exit 0
fi

# Safety: must have no open pull requests
pr_count=$(gh pr list --head "$target_branch" --json number --jq 'length')
if [ "$pr_count" -gt 0 ]; then
echo "Branch has open PRs, skipping deletion"
exit 0
fi

# Safety: must have no commits ahead of its base
base_branch="${GITHUB_REF##*/}"
ahead=$(gh api repos/${{ github.repository }}/compare/${base_branch}...${target_branch} --jq '.ahead_by')
if [ "$ahead" -gt 0 ]; then
echo "Branch has $ahead commit(s) ahead of $base_branch, skipping deletion"
exit 0
fi

gh api -X DELETE repos/${{ github.repository }}/git/refs/heads/$target_branch \
|| echo "Failed to delete branch, skipping"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading