Additional analyzer #270
This file contains 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
name: "PR: Create" | |
on: | |
push: | |
branches-ignore: | |
- master | |
- main | |
- "release/**" | |
- "hotfix/**" | |
- "feature/**" | |
permissions: | |
contents: read | |
pull-requests: write | |
concurrency: | |
group: ${{github.workflow}}-${{github.ref}} | |
cancel-in-progress: true | |
jobs: | |
pull-request: | |
runs-on: ubuntu-latest | |
env: | |
CREATE_DRAFT: true | |
steps: | |
- name: Cleanup Repo | |
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
- uses: juliangruber/[email protected] | |
id: findPr | |
with: | |
branch: ${{github.ref_name}} | |
- if: ${{steps.findPr.outputs.number != ''}} | |
run: | | |
echo "Pull request already exists with id: ${{steps.findPr.outputs.number}}" | |
echo "URL: https://github.com/${{github.repository}}/pull/${{steps.findPr.outputs.number}}" | |
- if: ${{steps.findPr.outputs.number == ''}} | |
id: pr-template | |
uses: juliangruber/[email protected] | |
with: | |
path: ./.github/PULL_REQUEST_TEMPLATE.md | |
- if: ${{steps.findPr.outputs.number == ''}} | |
run: echo "COMMIT_MSG=$(git log -1 --pretty=%B)" >> "$GITHUB_ENV" | |
- if: ${{steps.findPr.outputs.number != '' && github.repository_owner != 'funfair-tech'}} | |
name: "Check Repo Visibility" | |
uses: credfeto/[email protected] | |
id: visibility | |
with: | |
repository: ${{github.repository}} | |
token: ${{secrets.GITHUB_TOKEN}} | |
- if: ${{steps.findPr.outputs.number != '' && github.repository_owner != 'funfair-tech' && env.REPO_STATUS == 'private'}} | |
run: echo "CREATE_DRAFT=false" >> "$GITHUB_ENV" | |
- if: ${{steps.findPr.outputs.number == ''}} | |
id: open-pr | |
uses: repo-sync/[email protected] | |
with: | |
source_branch: "" # If blank, default: triggered branch | |
destination_branch: "main" # If blank, default: master | |
pr_assignee: ${{github.actor}} # Comma-separated list (no spaces) | |
pr_label: "auto-pr" # Comma-separated list (no spaces) | |
pr_draft: ${{env.CREATE_DRAFT}} # Creates pull request as draft | |
pr_title: ${{env.COMMIT_MSG}} | |
pr_body: ${{steps.pr-template.outputs.content}} | |
github_token: ${{github.token}} | |
- if: ${{steps.findPr.outputs.number == ''}} | |
name: New PR Details | |
run: | | |
echo "URL: ${{steps.open-pr.outputs.pr_url}}" | |
echo "PR: ${{steps.open-pr.outputs.pr_number}}" | |
echo "CF: ${{steps.open-pr.outputs.has_changed_files}}" | |
# TODO: Switch to actions/[email protected] if https://github.com/actions/labeler/pull/349 is merged and a release created | |
- if: ${{steps.findPr.outputs.number == ''}} | |
uses: credfeto/labeler@feature/pass-in-pull-request-or-issue | |
with: | |
repo-token: ${{secrets.SOURCE_PUSH_TOKEN}} | |
configuration-path: .github/labeler.yml | |
sync-labels: true | |
pr-number: ${{steps.open-pr.outputs.pr_number}} | |