Skip to content

Commit 7e58c2c

Browse files
authored
Merge pull request #7 from bcgov-nr/feat/composer-update
feat: test composer update
2 parents 6ee26e6 + 6ec5c5d commit 7e58c2c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Composer update check
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
run-container:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Log in to GitHub Container Registry
19+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u USERNAME --password-stdin
20+
21+
- name: Pull Container
22+
run: |
23+
docker pull ghcr.io/bcgov/nr-repository-composer:main
24+
25+
- name: Read catalog-info.yaml and run generators
26+
run: |
27+
GENERATORS=$(yq eval '.metadata.annotations."composer.io.nrs.gov.bc.ca/generators"' catalog-info.yaml)
28+
IFS=',' read -ra GEN_ARRAY <<< "$GENERATORS"
29+
for gen in "${GEN_ARRAY[@]}"; do
30+
git reset --hard
31+
docker run --rm -v ${PWD}:/src ghcr.io/bcgov/nr-repository-composer:main -- nr-repository-composer:"$gen" --promptless --force --headless || exit 1
32+
33+
if [[ -n "$(git status --porcelain)" ]]; then
34+
git config --global user.name "github-actions"
35+
git config --global user.email "github-actions@github.com"
36+
BRANCH_NAME="update-generated-files-$gen"
37+
git checkout -b "$BRANCH_NAME"
38+
git add .
39+
git commit -m "Automated update of generated files for $gen"
40+
git push origin "$BRANCH_NAME"
41+
gh pr create --base main --head "$BRANCH_NAME" --title "Automated update of generated files for $gen" --body "This PR contains updates to generated files for $gen."
42+
done

0 commit comments

Comments
 (0)