chore(app/name): Include repo name in the PR/MR application name (#136) #377
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: charts | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- charts/** | |
pull_request: | |
branches: | |
- main | |
paths: | |
- charts/** | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: read-all | |
jobs: | |
chart: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
pages: write | |
security-events: write | |
contents: write | |
if: ${{ github.event_name == 'pull_request' || contains(github.ref, 'main') }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.10.0 | |
- name: Setup Chart Linting | |
if: ${{ github.event_name == 'pull_request' }} | |
id: lint | |
uses: helm/[email protected] | |
- name: Run chart-testing (list-changed) | |
if: ${{ github.event_name == 'pull_request' }} | |
id: list-changed | |
run: | | |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) | |
if [[ -n "$changed" ]]; then | |
echo "::set-output name=changed::true" | |
fi | |
- name: Run chart-testing (lint) | |
if: ${{ github.event_name == 'pull_request' }} | |
run: ct lint --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false | |
- name: Configure Git | |
if: ${{ contains(github.ref, 'main') }} | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Copy Readme and License | |
if: ${{ contains(github.ref, 'main') }} | |
run: | | |
cp -v *.md charts/applicationset/ | |
- name: Run chart-releaser | |
if: ${{ contains(github.ref, 'main') }} | |
uses: helm/[email protected] | |
with: | |
charts_dir: charts | |
config: charts/cr.yml | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
continue-on-error: true | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
continue-on-error: true | |
k8s-test: | |
runs-on: ubuntu-latest | |
needs: [chart] | |
if: ${{ ! contains(github.ref, 'main') }} | |
steps: | |
- name: Create k8s Kind Cluster | |
uses: helm/[email protected] | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run K8s test | |
run: | | |
kubectl create ns argocd | |
kubectl apply -k https://github.com/argoproj/argo-cd/manifests/crds\?ref\=stable -n argocd | |
helm upgrade -i appsets charts/applicationset --namespace argocd --create-namespace | |
helm list -A | |
kubectl get all -A | |
kubectl get applications -A -o wide | |
kubectl get applicationsets -A -o wide | |
auto-approve: | |
runs-on: ubuntu-latest | |
needs: [chart, k8s-test] | |
permissions: | |
pull-requests: write | |
if: ${{ github.event_name == 'pull_request' }} | |
steps: | |
- name: Auto Approve PR | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.pulls.createReview({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number, | |
event: "APPROVE" | |
}) |