Skip to content

Remove comments and streamline pr-actions.yml #4

Remove comments and streamline pr-actions.yml

Remove comments and streamline pr-actions.yml #4

Workflow file for this run

# 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_files
lint_files:
name: "On demand Update Tests Results"
if: |
github.event.issue.pull_request &&
(github.event.comment.body == '/lint_files')
runs-on: ubuntu-latest
steps:
- 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 }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
repository: "${{ steps.get-branch.outputs.repository }}"
ref: "${{ steps.get-branch.outputs.branch }}"
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Specify your project's Node.js version
cache: 'npm' # Or 'yarn' or 'pnpm' based on your package manager
run: npm ci # Or 'yarn install --frozen-lockfile' or 'pnpm install --frozen-lockfile'
- name: Run Prettier
run: npx prettier --write .
- name: Push changes if needed
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "test: Update tests results"
branch: "${{ steps.get-branch.outputs.branch }}"
commit_user_name: Open Food Facts Bot
commit_user_email: [email protected]
commit_author: Open Food Facts Bot <[email protected]>
push_options: ""
status_options: '--untracked-files=no'
skip_dirty_check: false
create_branch: no