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

Smithy4s Kinesis Client #36

Merged
merged 32 commits into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3924f80
Update to ProjectMatrix
etspaceman Feb 5, 2023
98db831
Add crossScalaVersions
etspaceman Feb 5, 2023
7644a51
Add scalacOptions manually, generate workflows
etspaceman Feb 5, 2023
3829370
Merge remote-tracking branch 'origin/main' into smithy4sclient
etspaceman Feb 6, 2023
50576b9
Fix scalaVersion derivation
etspaceman Feb 6, 2023
2361949
Cleanup PR
etspaceman Feb 6, 2023
3cb8201
Clean up build
etspaceman Feb 6, 2023
cddb952
Delete ci.yml
etspaceman Feb 6, 2023
a50981b
Delete clean.yml
etspaceman Feb 6, 2023
66d97da
Ignore .sbt files
etspaceman Feb 6, 2023
cc11871
Fix class name
etspaceman Feb 6, 2023
120aeca
Workaround for kinesis-mock bugs, fixed localstack integration
etspaceman Feb 6, 2023
7e8722f
Note, bump memory
etspaceman Feb 6, 2023
c6652a0
Scaladoc
etspaceman Feb 7, 2023
1aaf41a
NoOpLogger default, markdowns
etspaceman Feb 7, 2023
7600912
Merge remote-tracking branch 'origin/main' into smithy4sclient
etspaceman Feb 10, 2023
635a7f9
Updates
etspaceman Feb 10, 2023
5f8385f
Better pretty rules
etspaceman Feb 10, 2023
2122036
Merge remote-tracking branch 'origin/main' into smithy4sclient
etspaceman Feb 10, 2023
4431a22
WIP on using kinesis spec with transformers
etspaceman Feb 10, 2023
fb4cdfe
Cleanup
etspaceman Feb 10, 2023
2d56736
More cleanup
etspaceman Feb 10, 2023
d200414
Merge remote-tracking branch 'origin/main' into smithy4sclient
etspaceman Feb 11, 2023
71d7199
Fixes
etspaceman Feb 11, 2023
9f0721a
Remove scala 2.12, project matrix
etspaceman Feb 11, 2023
315a933
Mergify plugin
etspaceman Feb 11, 2023
3714d04
fix build for some reason
etspaceman Feb 11, 2023
d244cb5
Remove scoverage, bring back scala 2.12/matrix
etspaceman Feb 12, 2023
94cbdd5
Fix for mergify labels
etspaceman Feb 12, 2023
4493101
Fixes
etspaceman Feb 12, 2023
a052373
remove compat dep
etspaceman Feb 12, 2023
4041601
Fix mima
etspaceman Feb 12, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p target shared/target kpl-ciris/target unidocs/target .js/target site/target kpl-tests/target kcl-localstack/target kpl/target kcl-logging-circe/target kcl-tests/target kcl-ciris/target kinesis-client-logging-circe/target shared-circe/target kpl-logging-circe/target kinesis-client/target .jvm/target kcl/target kpl-localstack/target .native/target kinesis-client-tests/target kcl-fs2/target shared-localstack/target aws-v1-localstack/target kinesis-client-localstack/target aws-v2-localstack/target shared-ciris/target kcl-http4s/target kcl-fs2-ciris/target compat/target project/target
run: mkdir -p smithy4s-client-tests/target target shared/target kpl-ciris/target unidocs/target smithy4s-client-logging-circe/target .js/target site/target kpl-tests/target kcl-localstack/target kpl/target kcl-logging-circe/target kcl-tests/target kcl-ciris/target kinesis-client-logging-circe/target shared-circe/target kpl-logging-circe/target kinesis-client/target .jvm/target kcl/target kpl-localstack/target .native/target kinesis-client-tests/target kcl-fs2/target shared-localstack/target aws-v1-localstack/target kinesis-client-localstack/target smithy4s-client-localstack/target aws-v2-localstack/target shared-ciris/target smithy4s-client/target kcl-http4s/target kcl-fs2-ciris/target compat/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar target shared/target kpl-ciris/target unidocs/target .js/target site/target kpl-tests/target kcl-localstack/target kpl/target kcl-logging-circe/target kcl-tests/target kcl-ciris/target kinesis-client-logging-circe/target shared-circe/target kpl-logging-circe/target kinesis-client/target .jvm/target kcl/target kpl-localstack/target .native/target kinesis-client-tests/target kcl-fs2/target shared-localstack/target aws-v1-localstack/target kinesis-client-localstack/target aws-v2-localstack/target shared-ciris/target kcl-http4s/target kcl-fs2-ciris/target compat/target project/target
run: tar cf targets.tar smithy4s-client-tests/target target shared/target kpl-ciris/target unidocs/target smithy4s-client-logging-circe/target .js/target site/target kpl-tests/target kcl-localstack/target kpl/target kcl-logging-circe/target kcl-tests/target kcl-ciris/target kinesis-client-logging-circe/target shared-circe/target kpl-logging-circe/target kinesis-client/target .jvm/target kcl/target kpl-localstack/target .native/target kinesis-client-tests/target kcl-fs2/target shared-localstack/target aws-v1-localstack/target kinesis-client-localstack/target smithy4s-client-localstack/target aws-v2-localstack/target shared-ciris/target smithy4s-client/target kcl-http4s/target kcl-fs2-ciris/target compat/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand Down
255 changes: 255 additions & 0 deletions .sbt/matrix/smithy4s-client/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
# This file was automatically generated by sbt-github-actions using the
# githubWorkflowGenerate task. You should add and commit this file to
# your git repository. It goes without saying that you shouldn't edit
# this file by hand! Instead, if you wish to make changes, you should
# change your sbt build configuration to revise the workflow description
# to meet your needs, then regenerate this file.

name: Continuous Integration

on:
pull_request:
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**', '!update/**', '!pr/**']
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10, 2.12.17, 3.2.2]
java: [temurin@17]
project: [rootJVM]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v3
with:
distribution: jdkfile
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Check that workflows are up to date
run: sbt githubWorkflowCheck

- name: Check headers and formatting
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll fmtCheck

- name: Test with coverage
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest' && matrix.scala != '3.2.2'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' 'IT / dockerComposeUp' cov 'IT / dockerComposeDown' 'FunctionalTest / dockerComposeUp' 'FunctionalTest / test' 'FunctionalTest / dockerComposeDown'

- name: Test
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest' && matrix.scala == '3.2.2'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' 'IT / dockerComposeUp' test 'IT / test' 'IT / dockerComposeDown' 'FunctionalTest / dockerComposeUp' 'FunctionalTest / test' 'FunctionalTest / dockerComposeDown'

- name: Check scalafix lints
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest' && matrix.scala != '3.2.2'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' fixCheck

- name: Check binary compatibility
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc

- name: Upload coverage
uses: ./.github/actions/upload-coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p smithy4s-client-tests/target/jvm-2.13 shared-ciris/target/jvm-3 aws-v1-localstack/target/jvm-2.12 kpl/target/jvm-3 target shared/target/jvm-2.13 kpl/target/jvm-2.12 kcl-ciris/target/jvm-3 kpl-ciris/target/jvm-2.13 kinesis-client-tests/target/jvm-2.12 kpl-ciris/target/jvm-2.12 smithy4s-client-localstack/target/jvm-3 smithy4s-client/target/jvm-3 unidocs/target/jvm-2.13 smithy4s-client-logging-circe/target/jvm-2.13 kcl-logging-circe/target/jvm-3 .js/target kcl-fs2-ciris/target/jvm-2.12 kinesis-client-logging-circe/target/jvm-3 aws-v1-localstack/target/jvm-3 kcl-tests/target/jvm-2.12 site/target/jvm-2.13 kinesis-client-localstack/target/jvm-3 shared/target/jvm-3 kpl-tests/target/jvm-2.13 kcl-localstack/target/jvm-2.13 kcl-fs2-ciris/target/jvm-3 kcl/target/jvm-3 kcl/target/jvm-2.12 unidocs/target/jvm-2.12 kpl-tests/target/jvm-3 shared-ciris/target/jvm-2.12 shared-localstack/target/jvm-2.12 kpl-tests/target/jvm-2.12 kcl-localstack/target/jvm-2.12 kpl/target/jvm-2.13 shared-circe/target/jvm-2.12 kcl-logging-circe/target/jvm-2.13 kinesis-client-tests/target/jvm-3 kcl-tests/target/jvm-2.13 kcl-ciris/target/jvm-2.13 kinesis-client-logging-circe/target/jvm-2.13 unidocs/target/jvm-3 compat/target/jvm-3 kinesis-client-logging-circe/target/jvm-2.12 shared-circe/target/jvm-2.13 kinesis-client/target/jvm-2.12 kpl-logging-circe/target/jvm-2.13 kcl-tests/target/jvm-3 aws-v2-localstack/target/jvm-3 kcl-http4s/target/jvm-2.12 aws-v2-localstack/target/jvm-2.12 kcl-logging-circe/target/jvm-2.12 kinesis-client/target/jvm-2.13 .jvm/target kcl/target/jvm-2.13 kpl-localstack/target/jvm-3 kpl-localstack/target/jvm-2.13 kcl-ciris/target/jvm-2.12 .native/target kinesis-client-tests/target/jvm-2.13 kcl-fs2/target/jvm-2.13 kcl-localstack/target/jvm-3 kcl-fs2/target/jvm-2.12 kinesis-client/target/jvm-3 shared-localstack/target/jvm-2.13 aws-v1-localstack/target/jvm-2.13 kinesis-client-localstack/target/jvm-2.13 kpl-logging-circe/target/jvm-3 smithy4s-client-localstack/target/jvm-2.13 aws-v2-localstack/target/jvm-2.13 kpl-logging-circe/target/jvm-2.12 kcl-fs2/target/jvm-3 shared/target/jvm-2.12 smithy4s-client-tests/target/jvm-3 shared-circe/target/jvm-3 shared-ciris/target/jvm-2.13 shared-localstack/target/jvm-3 compat/target/jvm-2.12 kpl-ciris/target/jvm-3 smithy4s-client/target/jvm-2.13 kpl-localstack/target/jvm-2.12 smithy4s-client-logging-circe/target/jvm-3 kcl-http4s/target/jvm-2.13 kinesis-client-localstack/target/jvm-2.12 kcl-fs2-ciris/target/jvm-2.13 kcl-http4s/target/jvm-3 compat/target/jvm-2.13 project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar smithy4s-client-tests/target/jvm-2.13 shared-ciris/target/jvm-3 aws-v1-localstack/target/jvm-2.12 kpl/target/jvm-3 target shared/target/jvm-2.13 kpl/target/jvm-2.12 kcl-ciris/target/jvm-3 kpl-ciris/target/jvm-2.13 kinesis-client-tests/target/jvm-2.12 kpl-ciris/target/jvm-2.12 smithy4s-client-localstack/target/jvm-3 smithy4s-client/target/jvm-3 unidocs/target/jvm-2.13 smithy4s-client-logging-circe/target/jvm-2.13 kcl-logging-circe/target/jvm-3 .js/target kcl-fs2-ciris/target/jvm-2.12 kinesis-client-logging-circe/target/jvm-3 aws-v1-localstack/target/jvm-3 kcl-tests/target/jvm-2.12 site/target/jvm-2.13 kinesis-client-localstack/target/jvm-3 shared/target/jvm-3 kpl-tests/target/jvm-2.13 kcl-localstack/target/jvm-2.13 kcl-fs2-ciris/target/jvm-3 kcl/target/jvm-3 kcl/target/jvm-2.12 unidocs/target/jvm-2.12 kpl-tests/target/jvm-3 shared-ciris/target/jvm-2.12 shared-localstack/target/jvm-2.12 kpl-tests/target/jvm-2.12 kcl-localstack/target/jvm-2.12 kpl/target/jvm-2.13 shared-circe/target/jvm-2.12 kcl-logging-circe/target/jvm-2.13 kinesis-client-tests/target/jvm-3 kcl-tests/target/jvm-2.13 kcl-ciris/target/jvm-2.13 kinesis-client-logging-circe/target/jvm-2.13 unidocs/target/jvm-3 compat/target/jvm-3 kinesis-client-logging-circe/target/jvm-2.12 shared-circe/target/jvm-2.13 kinesis-client/target/jvm-2.12 kpl-logging-circe/target/jvm-2.13 kcl-tests/target/jvm-3 aws-v2-localstack/target/jvm-3 kcl-http4s/target/jvm-2.12 aws-v2-localstack/target/jvm-2.12 kcl-logging-circe/target/jvm-2.12 kinesis-client/target/jvm-2.13 .jvm/target kcl/target/jvm-2.13 kpl-localstack/target/jvm-3 kpl-localstack/target/jvm-2.13 kcl-ciris/target/jvm-2.12 .native/target kinesis-client-tests/target/jvm-2.13 kcl-fs2/target/jvm-2.13 kcl-localstack/target/jvm-3 kcl-fs2/target/jvm-2.12 kinesis-client/target/jvm-3 shared-localstack/target/jvm-2.13 aws-v1-localstack/target/jvm-2.13 kinesis-client-localstack/target/jvm-2.13 kpl-logging-circe/target/jvm-3 smithy4s-client-localstack/target/jvm-2.13 aws-v2-localstack/target/jvm-2.13 kpl-logging-circe/target/jvm-2.12 kcl-fs2/target/jvm-3 shared/target/jvm-2.12 smithy4s-client-tests/target/jvm-3 shared-circe/target/jvm-3 shared-ciris/target/jvm-2.13 shared-localstack/target/jvm-3 compat/target/jvm-2.12 kpl-ciris/target/jvm-3 smithy4s-client/target/jvm-2.13 kpl-localstack/target/jvm-2.12 smithy4s-client-logging-circe/target/jvm-3 kcl-http4s/target/jvm-2.13 kinesis-client-localstack/target/jvm-2.12 kcl-fs2-ciris/target/jvm-2.13 kcl-http4s/target/jvm-3 compat/target/jvm-2.13 project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
uses: actions/upload-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
path: targets.tar

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.2.2]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v3
with:
distribution: jdkfile
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.13.10, rootJVM)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootJVM

- name: Inflate target directories (2.13.10, rootJVM)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.12.17, rootJVM)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootJVM

- name: Inflate target directories (2.12.17, rootJVM)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (3.2.2, rootJVM)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootJVM

- name: Inflate target directories (3.2.2, rootJVM)
run: |
tar xf targets.tar
rm targets.tar

- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
run: echo $PGP_SECRET | base64 -di | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
run: |
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)

- name: Publish
run: sbt '++ ${{ matrix.scala }}' tlRelease

site:
name: Generate Site
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.2.2]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v3
with:
distribution: jdkfile
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Generate site
run: sbt '++ ${{ matrix.scala }}' docs/tlSite

- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.9.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site/target/jvm-2.13/docs/site
keep_files: true
59 changes: 59 additions & 0 deletions .sbt/matrix/smithy4s-client/.github/workflows/clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This file was automatically generated by sbt-github-actions using the
# githubWorkflowGenerate task. You should add and commit this file to
# your git repository. It goes without saying that you shouldn't edit
# this file by hand! Instead, if you wish to make changes, you should
# change your sbt build configuration to revise the workflow description
# to meet your needs, then regenerate this file.

name: Clean

on: push

jobs:
delete-artifacts:
name: Delete Artifacts
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Delete artifacts
run: |
# Customize those three lines with your repository and credentials:
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
# A shortcut to call GitHub API.
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
# A temporary file which receives HTTP response headers.
TMPFILE=/tmp/tmp.$$
# An associative array, key: artifact name, value: number of artifacts of that name.
declare -A ARTCOUNT
# Process all artifacts on this repository, loop on returned "pages".
URL=$REPO/actions/artifacts
while [[ -n "$URL" ]]; do
# Get current page, get response headers in a temporary file.
JSON=$(ghapi --dump-header $TMPFILE "$URL")
# Get URL of next page. Will be empty if we are at the last page.
URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*<//' -e 's/>.*//')
rm -f $TMPFILE
# Number of artifacts on this page:
COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') ))
# Loop on all artifacts on this page.
for ((i=0; $i < $COUNT; i++)); do
# Get name of artifact and count instances of this name.
name=$(jq <<<$JSON -r ".artifacts[$i].name?")
ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1))
id=$(jq <<<$JSON -r ".artifacts[$i].id?")
size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") ))
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
ghapi -X DELETE $REPO/actions/artifacts/$id
done
done
Loading