Manifest #485
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: Manifest | ||
on: | ||
issue_comment: | ||
types: [created, edited] | ||
jobs: | ||
sync-chart-manifest-on-comment: | ||
if: contains(github.event.comment.body, '@meilisearch sync-manifest') | ||
name: Sync chart manifest on comment | ||
runs-on: ubuntu-latest | ||
steps: | ||
# There isn't enough detail in the github.event on "issue_comment" events about the PR origin, so we need to fetch more | ||
- name: "Get Pull Request" | ||
uses: actions/github-script@v6 | ||
id: get-pr | ||
with: | ||
script: | | ||
const request = { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.issue.number | ||
} | ||
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`) | ||
try { | ||
const result = await github.rest.pulls.get(request) | ||
return result.data | ||
} catch (err) { | ||
core.setFailed(`Request failed with error ${err}`) | ||
} | ||
# Now checkout the PR, generate the template and then commit to the PR | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }} | ||
ref: ${{ fromJSON(steps.get-pr.outputs.result).head.ref }} | ||
- name: Run helm template | ||
id: helm_template | ||
run: | | ||
helm template meilisearch charts/meilisearch | grep -v 'helm.sh/chart:\|app.kubernetes.io/managed-by:' > manifests/meilisearch.yaml | ||
echo "has_changes=$(if git diff --quiet && git diff --quiet --cached; then echo false; else echo true; fi)" >> "$GITHUB_ENV" | ||
- name: Commit manifest changes | ||
if: $has_changes == 'true' | ||
Check failure on line 47 in .github/workflows/update-chart-manifest.yaml GitHub Actions / ManifestInvalid workflow file
|
||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
git add . | ||
git commit -m "[CI] Syncing Helm manifest" | ||
git push --set-upstream origin ${{ fromJSON(steps.get-pr.outputs.result).head.ref }} |