Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 3 deletions .github/workflows/test-artifactory-login.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Test artifactory-login action

on:
push:
branches:
- master
pull_request:
paths:
- "actions/artifactory-login/**"

Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-build-and-push-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Test Build and Push Docker Image

on:
push:
branches:
- master
pull_request:
paths:
- "actions/build-docker/**"
- "actions/push-docker/**"
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-build-and-push-helm.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Test Build and Push Helm Chart

on:
push:
branches:
- master
pull_request:
paths:
- "actions/build-and-push-helm/**"

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test-eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Test ESLint repository

on:
pull_request:
push:
branches:
- master
paths:
- "actions/eslint/**"

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test-helm-lint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Helm Lint repository

on:
push:
branches:
- master
pull_request:
paths:
- "actions/helm-lint/**"

Expand All @@ -20,6 +18,7 @@ jobs:

- name: helm lint
uses: ./actions/helm-lint
id: helm-lint
with:
repository: ${{ github.repository }}
chartDirs: "./test/helm"
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test-init-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Init-npm repository

on:
pull_request:
push:
branches:
- master
paths:
- "actions/init-npm/**"

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test-openapi-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Test OpenApi-lint

on:
pull_request:
push:
branches:
- master
paths:
- "actions/opanapi-lint/**"

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test-update-artifacts-file.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Update artifacts.json

on:
push:
branches:
- master
pull_request:
paths:
- "actions/update-artifacts-file/**"

Expand All @@ -23,3 +21,4 @@ jobs:
artifact_tag: "5.0.17"
registry: ${{ secrets.ACR_URL }}
github_token: ${{ secrets.GH_PAT }}
target_repo: "mapcolonies/helm-charts-test"
1 change: 1 addition & 0 deletions actions/update-artifacts-file/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This GitHub Action builds and publishes a Helm chart to a specified registry and
| `registry` | Registry URL the artifact is pushed to (e.g., ACR address) | ✅ Yes | |
| `github_token` | GitHub token with permission to clone, commit & push to the target repo | ✅ Yes | |
| `target_repo` | Target GitHub repo where `artifacts.json` should be updated (e.g. `org/repo`)| ❌ No | `mapcolonies/helm-charts` |
| `target_branch` | Target branch in the repository to update | ❌ No | `master` |

---

Expand Down
6 changes: 6 additions & 0 deletions actions/update-artifacts-file/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ inputs:
description: "Target GitHub repository"
required: false
default: "mapcolonies/helm-charts"
target_branch:
description: "Target branch in the repository to update"
required: false
default: "master"

runs:
using: "composite"
Expand All @@ -37,6 +41,7 @@ runs:
repository: ${{ inputs.target_repo }}
token: ${{ inputs.github_token }}
path: $TARGET_PATH
ref: ${{ inputs.target_branch }}

- name: Set execute permission on modify script
run: chmod +x actions/update-artifacts-file/modify_artifacts.sh
Expand Down Expand Up @@ -68,6 +73,7 @@ runs:
GITHUB_TOKEN: ${{ inputs.github_token }}
TARGET_REPO: ${{ inputs.target_repo }}
TARGET_DIR: $TARGET_PATH
TARGET_BRANCH: ${{ inputs.target_branch }}

- name: Clean up target repo folder
run: rm -rf $TARGET_PATH
Expand Down
6 changes: 4 additions & 2 deletions actions/update-artifacts-file/commit_changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ cd "$TARGET_DIR"
git config user.name "mapcolonies[bot]"
git config user.email "devops[bot]@mapcolonies.com"

git checkout "$TARGET_BRANCH"

git add "$DOMAIN/artifacts.json"
git commit -m "chore: update artifacts.json for $DOMAIN" -m "with $TYPE artifact: $ARTIFACT_NAME:$ARTIFACT_TAG" || echo "Nothing to commit"

success=false
for ((i=1; i<=5; i++)); do
echo "Attempt $i to push changes..."
if git push https://x-access-token:$GITHUB_TOKEN@github.com/$TARGET_REPO.git; then
if git push https://x-access-token:$GITHUB_TOKEN@github.com/$TARGET_REPO.git "$TARGET_BRANCH"; then
success=true
echo "Push succeeded"
break
else
echo "Push failed, retrying after pull"
git pull origin master --ff-only || true
git pull origin "$TARGET_BRANCH" --ff-only || true
sleep 5
fi
done
Expand Down