name: Check PR
on: 
  pull_request_target:
    branches:
      - master

jobs:  
  check-pr:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v3
        with:
          repository: ${{ github.event.pull_request.head.repo.full_name }}
          ref: ${{ github.event.pull_request.head.ref }}
      # Runs a set of commands using the runners shell
      - name: chmod all install/install-32/install-64/uninstall to 775
        run: |
          cd $GITHUB_WORKSPACE
          chmod 775 ./apps/*/install ./apps/*/install-32 ./apps/*/install-64 ./apps/*/uninstall


      - name: Push changes to repo
        uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
        with:
          default_author: github_actions
          # The message for the commit.
          # Default: 'Commit from GitHub Actions (name of the workflow)'
          message: |
            Correct file permissions for install and uninstall files