Skip to content

CI TEST

CI TEST #22

Workflow file for this run

name: Fork PR Workflow
on:
pull_request:
types:
- opened
- synchronize
jobs:
create-resolve-branch:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Check if PR is from a fork
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_MAIL: 41898282+github-actions[bot]@users.noreply.github.com

Check failure on line 20 in .github/workflows/forked-pr.yml

View workflow run for this annotation

GitHub Actions / Fork PR Workflow

Invalid workflow file

The workflow is not valid. .github/workflows/forked-pr.yml (Line: 20, Col: 9): Unexpected value 'secrets' .github/workflows/forked-pr.yml (Line: 27, Col: 14): Unrecognized named-value: 'CI_TOKEN'. Located at position 1 within expression: CI_TOKEN
GITHUB_NAME: github-actions[bot]
run: |
if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]]; then
echo "* PR is from a fork, continuing with workflow..."
if [[ "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
BRANCH_NAME="resolve/pr-${PR_NUMBER}"
echo "* Cloning..."
git clone https://github.com/${{ github.repository }} workspace
cd workspace
echo "* Creating the resolve branch..."
git remote set-url origin https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git config --local user.email ${{ env.GITHUB_MAIL }}
git config --local user.name ${{ env.GITHUB_NAME }}
git switch main
git switch -c "$BRANCH_NAME"
git push origin "$BRANCH_NAME"
echo "* Changing the base branch..."
curl -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d "{\"base\": \"$BRANCH_NAME\"}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}"
echo "* Assigning reviewer..."
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"reviewers": ["heppokofrontend"]}' \
"https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers"
else
echo "* PR base branch is not main, skipping workflow..."
fi
else
echo "* PR is not from a fork, skipping workflow..."
fi