feat: refinement of knowledge panel rendering template. #67093
This file contains hidden or 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
| # This file contains actions that can be performed on PRs by issuing a comment | |
| name: 🕹️ On demand PR action | |
| on: | |
| issue_comment: | |
| types: [created, edited] | |
| jobs: | |
| # Action to update test results by issuing /lint | |
| run_lint: | |
| name: "On demand linting" | |
| if: | | |
| github.event.issue.pull_request && | |
| (github.event.comment.body == '/lint') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - &step-reaction-seen | |
| name: Add “seen” reaction to comment | |
| uses: peter-evans/create-or-update-comment@v5 | |
| with: | |
| comment-id: ${{ github.event.comment.id }} | |
| reactions: eyes | |
| - &get-repository-owner-branch | |
| name: Get repository, owner and branch name | |
| # see https://github.com/actions/checkout/issues/331 | |
| id: get-branch | |
| run: | | |
| echo branch=$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName') >> $GITHUB_OUTPUT | |
| echo owner=$(gh pr view $PR_NO --repo $REPO --json headRepositoryOwner --jq '.headRepositoryOwner.login') >> $GITHUB_OUTPUT | |
| echo repository=$(gh pr view $PR_NO --repo $REPO --json headRepositoryOwner,headRepository --jq '.headRepositoryOwner.login + "/" + .headRepository.name') >> $GITHUB_OUTPUT | |
| env: | |
| REPO: ${{ github.repository }} | |
| PR_NO: ${{ github.event.issue.number }} | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
| - &checkout-fork-repo | |
| name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| # we need to checkout the fork repository | |
| # see https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#workflow-should-run-in-base-repository | |
| fetch-depth: 1 | |
| repository: "${{ steps.get-branch.outputs.repository }}" | |
| ref: "${{ steps.get-branch.outputs.branch }}" | |
| # We can't use GITHUB_TOKEN here because, github actions can't trigger actions | |
| # see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow | |
| # So this is a personal access token | |
| token: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
| # we need origin/main to have comparison linting work ! | |
| - &fetch-origin-main | |
| name: Fetch origin/main | |
| run: | | |
| git remote set-branches --add origin main | |
| git fetch origin | |
| - &run-linting | |
| name: Run linting | |
| run: make lint front_lint | |
| - name: Push changes if needed | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: "chore: Linting changes" | |
| branch: "${{ steps.get-branch.outputs.branch }}" | |
| commit_user_name: Open Food Facts Bot | |
| commit_user_email: contact@openfoodfacts.org | |
| commit_author: Open Food Facts Bot <contact@openfoodfacts.org> | |
| push_options: "" | |
| status_options: '--untracked-files=no' | |
| skip_dirty_check: false | |
| create_branch: no | |
| - &step-reaction-completed | |
| name: Add “completed” reaction to comment | |
| uses: peter-evans/create-or-update-comment@v5 | |
| with: | |
| comment-id: ${{ github.event.comment.id }} | |
| reactions: rocket | |
| reactions-edit-mode: replace | |
| # Action to update test results by issuing /update_tests_results | |
| update_test_results: | |
| name: "On demand Update Tests Results" | |
| if: | | |
| github.event.issue.pull_request && | |
| (github.event.comment.body == '/update_tests_results') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - *step-reaction-seen | |
| - *get-repository-owner-branch | |
| - *checkout-fork-repo | |
| - &run-update-tests-results | |
| name: Run update tests results | |
| run: make update_tests_results | |
| - name: Push changes if needed | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: "test: Update tests results" | |
| branch: "${{ steps.get-branch.outputs.branch }}" | |
| file_pattern: 'tests/**/expected_test_results/**' | |
| commit_user_name: Open Food Facts Bot | |
| commit_user_email: contact@openfoodfacts.org | |
| commit_author: Open Food Facts Bot <contact@openfoodfacts.org> | |
| add_options: '--all' | |
| push_options: "" | |
| status_options: '--untracked-files=no' | |
| skip_dirty_check: false | |
| create_branch: no | |
| - *step-reaction-completed | |
| # Action to lint _and_ update test results in one go | |
| lint_and_update_test_results: | |
| name: "On demand linting and updating of test results" | |
| if: | | |
| github.event.issue.pull_request && | |
| ((github.event.comment.body == '/lint+update_test_results') || | |
| (github.event.comment.body == '/lint+update_tests_results')) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - *step-reaction-seen | |
| - *get-repository-owner-branch | |
| - *checkout-fork-repo | |
| - *fetch-origin-main | |
| - name: Create folders | |
| run: make create_folders | |
| - *run-linting | |
| - *run-update-tests-results | |
| - name: Push changes if needed | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: "chore: Linting and test results changes" | |
| branch: "${{ steps.get-branch.outputs.branch }}" | |
| commit_user_name: Open Food Facts Bot | |
| commit_user_email: contact@openfoodfacts.org | |
| commit_author: Open Food Facts Bot <contact@openfoodfacts.org> | |
| push_options: "" | |
| status_options: '--untracked-files=no' | |
| skip_dirty_check: false | |
| create_branch: no | |
| - *step-reaction-completed |