mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
ci: add a workflow to auto-update test vendored repos (#22754)
This commit is contained in:
2
.github/actions/bump/action.yml
vendored
2
.github/actions/bump/action.yml
vendored
@@ -25,7 +25,7 @@ runs:
|
|||||||
echo "version=$LATEST" >> $GITHUB_OUTPUT
|
echo "version=$LATEST" >> $GITHUB_OUTPUT
|
||||||
echo "message=$MESSAGE" >> $GITHUB_OUTPUT
|
echo "message=$MESSAGE" >> $GITHUB_OUTPUT
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
add-paths: |
|
add-paths: |
|
||||||
CMakeLists.txt
|
CMakeLists.txt
|
||||||
|
|||||||
2
.github/workflows/update-cares.yml
vendored
2
.github/workflows/update-cares.yml
vendored
@@ -80,7 +80,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
add-paths: |
|
add-paths: |
|
||||||
|
|||||||
4
.github/workflows/update-hdrhistogram.yml
vendored
4
.github/workflows/update-hdrhistogram.yml
vendored
@@ -55,7 +55,7 @@ jobs:
|
|||||||
echo "Error: Could not fetch SHA for tag $LATEST_TAG"
|
echo "Error: Could not fetch SHA for tag $LATEST_TAG"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to get commit SHA from tag object (for annotated tags)
|
# Try to get commit SHA from tag object (for annotated tags)
|
||||||
# If it fails, assume it's a lightweight tag pointing directly to commit
|
# If it fails, assume it's a lightweight tag pointing directly to commit
|
||||||
LATEST_SHA=$(curl -sL "https://api.github.com/repos/HdrHistogram/HdrHistogram_c/git/tags/$LATEST_TAG_SHA" 2>/dev/null | jq -r '.object.sha // empty')
|
LATEST_SHA=$(curl -sL "https://api.github.com/repos/HdrHistogram/HdrHistogram_c/git/tags/$LATEST_TAG_SHA" 2>/dev/null | jq -r '.object.sha // empty')
|
||||||
@@ -83,7 +83,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
add-paths: |
|
add-paths: |
|
||||||
|
|||||||
4
.github/workflows/update-highway.yml
vendored
4
.github/workflows/update-highway.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
|||||||
|
|
||||||
TAG_OBJECT_SHA=$(echo "$TAG_REF" | jq -r '.object.sha')
|
TAG_OBJECT_SHA=$(echo "$TAG_REF" | jq -r '.object.sha')
|
||||||
TAG_OBJECT_TYPE=$(echo "$TAG_REF" | jq -r '.object.type')
|
TAG_OBJECT_TYPE=$(echo "$TAG_REF" | jq -r '.object.type')
|
||||||
|
|
||||||
if [ -z "$TAG_OBJECT_SHA" ] || [ "$TAG_OBJECT_SHA" = "null" ]; then
|
if [ -z "$TAG_OBJECT_SHA" ] || [ "$TAG_OBJECT_SHA" = "null" ]; then
|
||||||
echo "Error: Could not fetch SHA for tag $LATEST_TAG"
|
echo "Error: Could not fetch SHA for tag $LATEST_TAG"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -99,7 +99,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
add-paths: |
|
add-paths: |
|
||||||
|
|||||||
2
.github/workflows/update-libarchive.yml
vendored
2
.github/workflows/update-libarchive.yml
vendored
@@ -80,7 +80,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
add-paths: |
|
add-paths: |
|
||||||
|
|||||||
2
.github/workflows/update-libdeflate.yml
vendored
2
.github/workflows/update-libdeflate.yml
vendored
@@ -80,7 +80,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
add-paths: |
|
add-paths: |
|
||||||
|
|||||||
6
.github/workflows/update-lolhtml.yml
vendored
6
.github/workflows/update-lolhtml.yml
vendored
@@ -55,12 +55,12 @@ jobs:
|
|||||||
TAG_REF_RESPONSE=$(curl -sL "https://api.github.com/repos/cloudflare/lol-html/git/refs/tags/$LATEST_TAG")
|
TAG_REF_RESPONSE=$(curl -sL "https://api.github.com/repos/cloudflare/lol-html/git/refs/tags/$LATEST_TAG")
|
||||||
LATEST_TAG_SHA=$(echo "$TAG_REF_RESPONSE" | jq -r '.object.sha')
|
LATEST_TAG_SHA=$(echo "$TAG_REF_RESPONSE" | jq -r '.object.sha')
|
||||||
TAG_OBJECT_TYPE=$(echo "$TAG_REF_RESPONSE" | jq -r '.object.type')
|
TAG_OBJECT_TYPE=$(echo "$TAG_REF_RESPONSE" | jq -r '.object.type')
|
||||||
|
|
||||||
if [ -z "$LATEST_TAG_SHA" ] || [ "$LATEST_TAG_SHA" = "null" ]; then
|
if [ -z "$LATEST_TAG_SHA" ] || [ "$LATEST_TAG_SHA" = "null" ]; then
|
||||||
echo "Error: Could not fetch SHA for tag $LATEST_TAG"
|
echo "Error: Could not fetch SHA for tag $LATEST_TAG"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TAG_OBJECT_TYPE" = "tag" ]; then
|
if [ "$TAG_OBJECT_TYPE" = "tag" ]; then
|
||||||
# This is an annotated tag, we need to get the commit it points to
|
# This is an annotated tag, we need to get the commit it points to
|
||||||
LATEST_SHA=$(curl -sL "https://api.github.com/repos/cloudflare/lol-html/git/tags/$LATEST_TAG_SHA" | jq -r '.object.sha')
|
LATEST_SHA=$(curl -sL "https://api.github.com/repos/cloudflare/lol-html/git/tags/$LATEST_TAG_SHA" | jq -r '.object.sha')
|
||||||
@@ -92,7 +92,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
add-paths: |
|
add-paths: |
|
||||||
|
|||||||
4
.github/workflows/update-lshpack.yml
vendored
4
.github/workflows/update-lshpack.yml
vendored
@@ -59,7 +59,7 @@ jobs:
|
|||||||
|
|
||||||
LATEST_TAG_SHA=$(echo "$TAG_REF" | jq -r '.object.sha')
|
LATEST_TAG_SHA=$(echo "$TAG_REF" | jq -r '.object.sha')
|
||||||
TAG_TYPE=$(echo "$TAG_REF" | jq -r '.object.type')
|
TAG_TYPE=$(echo "$TAG_REF" | jq -r '.object.type')
|
||||||
|
|
||||||
if [ -z "$LATEST_TAG_SHA" ] || [ "$LATEST_TAG_SHA" = "null" ]; then
|
if [ -z "$LATEST_TAG_SHA" ] || [ "$LATEST_TAG_SHA" = "null" ]; then
|
||||||
echo "Error: Could not fetch SHA for tag $LATEST_TAG"
|
echo "Error: Could not fetch SHA for tag $LATEST_TAG"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -97,7 +97,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
add-paths: |
|
add-paths: |
|
||||||
|
|||||||
2
.github/workflows/update-sqlite3.yml
vendored
2
.github/workflows/update-sqlite3.yml
vendored
@@ -91,7 +91,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success() && steps.check-version.outputs.current_num < steps.check-version.outputs.latest_num
|
if: success() && steps.check-version.outputs.current_num < steps.check-version.outputs.latest_num
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
add-paths: |
|
add-paths: |
|
||||||
|
|||||||
79
.github/workflows/update-vendor.yml
vendored
Normal file
79
.github/workflows/update-vendor.yml
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
name: Update vendor
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 4 * * 0"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-update:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
package:
|
||||||
|
- elysia
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
|
||||||
|
- name: Check version
|
||||||
|
id: check-version
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Extract the commit hash from the line after COMMIT
|
||||||
|
current=$(bun -p '(await Bun.file("test/vendor.json").json()).filter(v=>v.package===process.argv[1])[0].tag' ${{ matrix.package }})
|
||||||
|
repository=$(bun -p '(await Bun.file("test/vendor.json").json()).filter(v=>v.package===process.argv[1])[0].repository' ${{ matrix.package }} | cut -d'/' -f4,5)
|
||||||
|
|
||||||
|
if [ -z "$current" ]; then
|
||||||
|
echo "Error: Could not find COMMIT line in test/vendor.json"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "current=$current" >> $GITHUB_OUTPUT
|
||||||
|
echo "repository=$repository" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
LATEST_RELEASE=$(curl -sL https://api.github.com/repos/${repository}/releases/latest)
|
||||||
|
if [ -z "$LATEST_RELEASE" ]; then
|
||||||
|
echo "Error: Failed to fetch latest release from GitHub API"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
LATEST_TAG=$(echo "$LATEST_RELEASE" | jq -r '.tag_name')
|
||||||
|
if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" = "null" ]; then
|
||||||
|
echo "Error: Could not extract tag name from GitHub API response"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "latest=$LATEST_TAG" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Update version if needed
|
||||||
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
bun -e 'await Bun.write("test/vendor.json", JSON.stringify((await Bun.file("test/vendor.json").json()).map(v=>{if(v.package===process.argv[1])v.tag=process.argv[2];return v;}), null, 2) + "\n")' ${{ matrix.package }} ${{ steps.check-version.outputs.latest }}
|
||||||
|
|
||||||
|
- name: Create Pull Request
|
||||||
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
|
uses: peter-evans/create-pull-request@v7
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
add-paths: |
|
||||||
|
test/vendor.json
|
||||||
|
commit-message: "deps: update ${{ matrix.package }} to ${{ steps.check-version.outputs.latest }} (${{ steps.check-version.outputs.latest }})"
|
||||||
|
title: "deps: update ${{ matrix.package }} to ${{ steps.check-version.outputs.latest }}"
|
||||||
|
delete-branch: true
|
||||||
|
branch: deps/update-${{ matrix.package }}-${{ github.run_number }}
|
||||||
|
body: |
|
||||||
|
## What does this PR do?
|
||||||
|
|
||||||
|
Updates ${{ matrix.package }} to version ${{ steps.check-version.outputs.latest }}
|
||||||
|
|
||||||
|
Compare: https://github.com/${{ steps.check-version.outputs.repository }}/compare/${{ steps.check-version.outputs.current }}...${{ steps.check-version.outputs.latest }}
|
||||||
|
|
||||||
|
Auto-updated by [this workflow](https://github.com/oven-sh/bun/actions/workflows/update-vendor.yml)
|
||||||
2
.github/workflows/update-zstd.yml
vendored
2
.github/workflows/update-zstd.yml
vendored
@@ -80,7 +80,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
if: success() && steps.check-version.outputs.current != steps.check-version.outputs.latest
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
add-paths: |
|
add-paths: |
|
||||||
|
|||||||
Reference in New Issue
Block a user