1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-07-19 01:29:40 +02:00

chore(ci): cache release-notes-assistant working directory [skip ci] (#8556)

to reduce the number of requests to the API to obtain each pull request to the minimum.

- cache the working directory
- upgrade to [v1.3.0](https://code.forgejo.org/forgejo/release-notes-assistant/releases/tag/v1.3.0) to get optimizations
- use the oci:1 image to reduce the network load re-installing every time

## Testing

- Pushed to https://codeberg.org/forgejo/forgejo/src/branch/wip-rna so that it gets access to the secrets
- Manually triggered [to populate the cache](https://codeberg.org/forgejo/forgejo/actions/runs/89735) cutting the run time from ~2h to ~45min
- Manually triggered [to verify the cache is reused](https://codeberg.org/forgejo/forgejo/actions/runs/89759) cutting the run time from ~45min to ~15min
  ![image](/attachments/3ae48d6d-0d38-4559-8544-f0bc71eb2040)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8556
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-07-18 16:09:25 +02:00 committed by Earl Warren
parent 88c3b6dead
commit eaea89b7f0

View file

@ -5,32 +5,34 @@ on:
- cron: '@daily'
env:
RNA_VERSION: v1.2.5 # renovate: datasource=gitea-releases depName=forgejo/release-notes-assistant registryUrl=https://code.forgejo.org
RNA_WORKDIR: /srv/rna
RNA_VERSION: v1.3.0 # renovate: datasource=gitea-releases depName=forgejo/release-notes-assistant registryUrl=https://code.forgejo.org
jobs:
release-notes:
if: vars.ROLE == 'forgejo-coding'
runs-on: docker
container:
image: 'data.forgejo.org/oci/node:22-bookworm'
image: 'data.forgejo.org/oci/ci:1'
steps:
- uses: https://data.forgejo.org/actions/checkout@v4
- uses: https://data.forgejo.org/actions/setup-go@v5
- uses: https://data.forgejo.org/actions/cache@v4
with:
go-version-file: "go.mod"
cache: false
key: rna-${{ env.RNA_VERSION }}
path: ${{ env.RNA_WORKDIR }}
- name: apt install jq
- name: install release-notes-assistant
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get -q install -y -qq jq
set -x
wget -O /usr/local/bin/rna https://code.forgejo.org/forgejo/release-notes-assistant/releases/download/${{ env.RNA_VERSION}}/release-notes-assistant
chmod +x /usr/local/bin/rna
- name: update open milestones
run: |
set -x
curl -sS $GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/milestones?state=open | jq -r '.[] | .title' | while read forgejo version ; do
mkdir -p ${{ env.RNA_WORKDIR }}
curl -sS $FORGEJO_SERVER_URL/api/v1/repos/$FORGEJO_REPOSITORY/milestones?state=open | jq -r '.[] | .title' | while read forgejo version ; do
milestone="$forgejo $version"
go run code.forgejo.org/forgejo/release-notes-assistant@$RNA_VERSION --config .release-notes-assistant.yaml --storage milestone --storage-location "$milestone" --forgejo-url $GITHUB_SERVER_URL --repository $GITHUB_REPOSITORY --token ${{ secrets.RELEASE_NOTES_ASSISTANT_TOKEN }} release $version
rna --workdir ${{ env.RNA_WORKDIR }} --config .release-notes-assistant.yaml --storage milestone --storage-location "$milestone" --forgejo-url $FORGEJO_SERVER_URL --repository $FORGEJO_REPOSITORY --token ${{ secrets.RELEASE_NOTES_ASSISTANT_TOKEN }} release $version
done