From 5ce61dd491ab7e26ecee180378f784ff3050e66e Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Wed, 7 Aug 2024 11:25:59 +0200 Subject: [PATCH 1/2] ci: Create on-demand.yml --- .github/workflows/on-demand.yml | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/on-demand.yml diff --git a/.github/workflows/on-demand.yml b/.github/workflows/on-demand.yml new file mode 100644 index 00000000000..f9a51dca530 --- /dev/null +++ b/.github/workflows/on-demand.yml @@ -0,0 +1,54 @@ +# 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') && + contains(fromJSON('["COLLABORATOR", "CONTRIBUTOR", "MEMBER", "OWNER"]'), github.event.comment.author_association) + runs-on: ubuntu-latest + steps: + - name: Get branch name + # see https://github.com/actions/checkout/issues/331 + id: get-branch + run: echo ::set-output name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName') + env: + REPO: ${{ github.repository }} + PR_NO: ${{ github.event.issue.number }} + GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + # grab the PR branch + 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 ! + - name: Fetch origin/develop + run: | + git remote set-branches --add origin develop + git fetch origin + - name: Run linting + run: XXXXXXXX + - name: Push changes if needed + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "chore: Linting changes" + branch: ${{ github.event.pull_request.head.ref }} + commit_user_name: Open Food Facts Bot + commit_user_email: contact@openfoodfacts.org + commit_author: Open Food Facts Bot + push_options: "" + status_options: '--untracked-files=no' + skip_dirty_check: false + create_branch: no From 3a581a2057e9348391e005f68fc412d2c8473e5e Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 12 Aug 2024 08:57:57 +0200 Subject: [PATCH 2/2] Update on-demand.yml --- .github/workflows/on-demand.yml | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/on-demand.yml b/.github/workflows/on-demand.yml index f9a51dca530..2161cd4b2cd 100644 --- a/.github/workflows/on-demand.yml +++ b/.github/workflows/on-demand.yml @@ -52,3 +52,51 @@ jobs: status_options: '--untracked-files=no' skip_dirty_check: false create_branch: no + + delete_3_letter_translation_files: + name: "On demand deletion of 3-letter translation files" + if: | + github.event.issue.pull_request && + (github.event.comment.body == '/lint') && + contains(fromJSON('["COLLABORATOR", "CONTRIBUTOR", "MEMBER", "OWNER"]'), github.event.comment.author_association) + runs-on: ubuntu-latest + steps: + - name: Get branch name + # see https://github.com/actions/checkout/issues/331 + id: get-branch + run: echo ::set-output name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName') + env: + REPO: ${{ github.repository }} + PR_NO: ${{ github.event.issue.number }} + GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + # grab the PR branch + 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 ! + - name: Fetch origin/develop + run: | + git remote set-branches --add origin develop + git fetch origin + - name: Deletion of 3-letter translation files (1/2) + run: packages/smooth_app/ios/Runner/remove.sh + - name: Deletion of 3-letter translation files (2/2) + run: packages/smooth_app/lib/l10n/remove_3_letter_locales.sh + - name: Push changes if needed + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "chore: Deletion of 3-letter translation files" + branch: ${{ github.event.pull_request.head.ref }} + commit_user_name: Open Food Facts Bot + commit_user_email: contact@openfoodfacts.org + commit_author: Open Food Facts Bot + push_options: "" + status_options: '--untracked-files=no' + skip_dirty_check: false + create_branch: no