Changes related to the next Meilisearch release (v1.4.0) #455
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.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@v3 | |
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 "::set-output name=has_changes::$(if git diff --quiet && git diff --quiet --cached; then echo "false"; else echo "true"; fi)" | |
- name: Commit manifest changes | |
if: steps.helm_template.outputs.has_changes == 'true' | |
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 }} |