Skip to content

Commit 6e7aa3f

Browse files
authored
ci(general): add update catalyst ci deps workflow (#445)
1 parent 96e88d4 commit 6e7aa3f

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Update Catalyst CI Deps
2+
3+
on:
4+
release:
5+
types: [published, edited]
6+
workflow_dispatch:
7+
inputs:
8+
dry_run:
9+
description: "Run in dry-run mode (no PRs created)"
10+
type: boolean
11+
default: false
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
jobs:
18+
notify-dependents:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Get release info
22+
id: release_info
23+
run: |
24+
if [ "${{ github.event_name }}" = "release" ]; then
25+
echo "tag_name=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
26+
echo "release_url=${{ github.event.release.html_url }}" >> $GITHUB_OUTPUT
27+
echo "release_notes=${{ github.event.release.body }}" >> $GITHUB_OUTPUT
28+
else
29+
# For manual dispatch, use latest release
30+
LATEST_TAG=$(git describe --tags --abbrev=0)
31+
echo "tag_name=$LATEST_TAG" >> $GITHUB_OUTPUT
32+
echo "release_url=https://github.com/${{ github.repository }}/releases/latest" >> $GITHUB_OUTPUT
33+
echo "release_notes=Manual dispatch" >> $GITHUB_OUTPUT
34+
fi
35+
36+
- name: Create PRs for dependent repositories
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
DRY_RUN: ${{ inputs.dry_run }}
40+
RELEASE_TAG: ${{ steps.release_info.outputs.tag_name }}
41+
RELEASE_URL: ${{ steps.release_info.outputs.release_url }}
42+
RELEASE_NOTES: ${{ steps.release_info.outputs.release_notes }}
43+
run: |
44+
REPOS=(
45+
"input-output-hk/catalyst-voices"
46+
"input-output-hk/hermes"
47+
"input-output-hk/catalyst-libs"
48+
"input-output-hk/catalyst-reviews"
49+
"input-output-hk/catalyst-som"
50+
"input-output-hk/catalyst-execution"
51+
"input-output-hk/norns"
52+
)
53+
54+
for repo in "${REPOS[@]}"; do
55+
repo=$(echo "$repo" | tr -d ' ')
56+
if [ -n "$repo" ]; then
57+
echo "Processing $repo"
58+
59+
if [ "$DRY_RUN" = "true" ]; then
60+
echo "[DRY RUN] Would create PR for $repo"
61+
else
62+
branch_name="chore/update-catalyst-ci-to-$(echo $RELEASE_TAG | tr -d 'v')"
63+
64+
default_branch=$(gh api repos/$repo --jq '.default_branch')
65+
base_sha=$(gh api repos/$repo/branches/$default_branch --jq '.commit.sha')
66+
gh api repos/$repo/git/refs -f ref="refs/heads/$branch_name" -f sha="$base_sha"
67+
gh pr create \
68+
--repo "$repo" \
69+
--title "Update catalyst-ci to $RELEASE_TAG" \
70+
--body "Update catalyst-ci to $RELEASE_TAG. Release: $RELEASE_URL" \
71+
--head "$branch_name" \
72+
--base "$default_branch"
73+
74+
echo "Created PR for $repo"
75+
fi
76+
77+
sleep 2
78+
fi
79+
done

0 commit comments

Comments
 (0)