Skip to content

Commit 45ff61d

Browse files
authored
feat(ci): add release check to ensure new component repos exist (#8447)
1 parent 754d84d commit 45ff61d

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/release-checks.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
pull_request:
44
types: [opened, synchronize, reopened, edited]
55
branches: ['main']
6+
permissions:
7+
contents: read
68
jobs:
79
# More info at https://github.com/Roave/BackwardCompatibilityCheck.
810
backwards-compatibility-check:
@@ -88,3 +90,34 @@ jobs:
8890
echo "major version releases for those components"
8991
exit 1
9092
fi
93+
94+
# Ensure that if the release PR contains any NEW components, the new component's corresponding
95+
# sub-repo exists
96+
new-component-subrepo-check:
97+
name: New Component Sub-Repo Check
98+
runs-on: ubuntu-latest
99+
if: github.event.pull_request.user.login == 'release-please[bot]'
100+
steps:
101+
- uses: actions/checkout@v4
102+
with:
103+
fetch-depth: 0
104+
- name: "Check for unexpected major version"
105+
run: |
106+
COMPONENTS=$(git diff origin/main --name-only | grep VERSION | xargs dirname)
107+
FAIL=""
108+
for COMPONENT in ${COMPONENTS}; do {
109+
if [[ "$(cat $COMPONENT/VERSION)" == "0.1.0" ]]; then
110+
SUBREPO=$(cat $COMPONENT/composer.json | jq -r '.extra.component.target')
111+
echo "New component found: $COMPONENT"
112+
if curl --head --silent --fail "https://api.github.com/repos/$SUBREPO" -H 'Authorization: Bearer ${{secrets.GITHUB_TOKEN}}' > /dev/null; then
113+
echo " - Target Repo '$SUBREPO' exists"
114+
else
115+
echo " - Target Repo '$SUBREPO' DOES NOT EXIST"
116+
FAIL="true"
117+
fi
118+
fi
119+
}; done
120+
if [[ "$FAIL" == "true" ]]; then
121+
echo "Missing repositories for one or more new components"
122+
exit 1
123+
fi

0 commit comments

Comments
 (0)