Files
rinoa-docker/.gitea/workflows/deployment.yml
T
2024-12-24 15:37:00 -05:00

48 lines
1.8 KiB
YAML

name: Gitea Branch PR, SonarQube Analyze, and Merge Workflow
on:
push:
branches-ignore:
- main
jobs:
# Job 1: Check if PR exists and create one if the branch is new
check-and-create-pr:
name: Check and Create PR
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: PR list
id: list-prs
run: |
curl -sSL https://dl.gitea.com/tea/main/tea-main-linux-amd64 -o /usr/local/bin/tea
chmod +x /usr/local/bin/tea
echo "Merging PR..."
tea login add --name gitea-rinoa --url "${{ vars.RINOA_GITEA_URL }}" --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token "${{ secrets.BOT_GITEA_TOKEN }}"
tea pr ls --repo ${{ github.repository }} --state open --output csv | egrep 'open'
if [ $? -eq 0 ]; then
echo "PR already exists. Skipping PR creation."
pr_index=$(tea pr ls --repo ${{ github.repository }} --state open --output csv | egrep ${{ gitea.ref_name }}" | awk -F, '{print $1}' | sed -e 's|"||g')
echo "pr_index=${pr_index}" >> "$GITHUB_OUTPUT"
echo "list_exit=$?" >> "$GITHUB_OUTPUT"
- name: List PRs
run: |
echo "PR count: ${{ steps.list-prs.outputs.pullRequestNumbers }}"
- name: Create PR
if: steps.list-prs.outputs.list_exit != 0
uses: arifer612/Gitea-PR-action@v1.2.0
with:
url: ${{ gitea.server_url }}
token: ${{ secrets.BOT_GITEA_TOKEN }}
assignee: ${{ gitea.actor }}
- name: Linting
uses: super-linter/super-linter@v7.2.1
env:
GITHUB_CUSTOM_SERVER_URL: ${{ gitea.server_url }}
GITHUB_CUSTOM_API_URL: ${{ gitea.server_url }}/api/v1