Testing PR listing action

This commit is contained in:
2024-12-06 13:24:43 -05:00
parent 6285475c65
commit 8b994ed05d
+63 -64
View File
@@ -15,72 +15,71 @@ jobs:
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Check if Pull Request Exists - name: Gitea List Pull Requests
id: check-pr id: gitea-check-pr
uses: prasiman/gocurl@v1 uses: vicamo/gitea-list-pull-requests@v1.0.1
with: with:
url: "${{ secrets.GITEA_API_URL }}/repos/${{ github.repository_owner }}/pulls?state=open&head=${{ github.repository_owner }}:${{ github.ref_name }}"
method: GET
headers: |
Authorization: token ${{ secrets.GITEA_API_TOKEN }}
outputs:
response: ${{ steps.check-pr.outputs.response }}
- name: Create Pull Request
if: env.PR_EXISTS != 'true'
uses: arifer612/Gitea-PR-action@v1.2.0
with:
url: ${{ secrets.RINOA_GITEA_SERVER }}
token: ${{ secrets.BOT_GITEA_TOKEN }} token: ${{ secrets.BOT_GITEA_TOKEN }}
- name: Run SonarQube Analysis server_url: ${{ secrets.RINOA_GITEA_SERVER }}
uses: SonarSource/sonarqube-scan-action@v4.1.0 state: open
with: # - name: Set PR_EXISTS environment variable
SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }} # run: echo "PR_EXISTS=${{ steps.gitea-check-pr.outputs.exists }}" >> $GITHUB_ENV
sonar_token: ${{ secrets.SONARQUBE_TOKEN }} # - name: Create Pull Request
extra_args: | # if: env.PR_EXISTS != 'true'
-Dsonar.projectKey=${{ github.repository }} # uses: arifer612/Gitea-PR-action@v1.2.0
-Dsonar.sources=. # with:
-Dsonar.inclusions=docker-compose.yml # url: ${{ secrets.RINOA_GITEA_SERVER }}
-Dsonar.language=yaml,docker # token: ${{ secrets.BOT_GITEA_TOKEN }}
- name: Check SonarQube Quality Gate # # - name: Run SonarQube Analysis
id: quality-gate # uses: SonarSource/sonarqube-scan-action@v4.1.0
uses: SonarSource/sonarqube-quality-gate-action@v1.1.0 # with:
with: # SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }}
SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }} # sonar_token: ${{ secrets.SONARQUBE_TOKEN }}
sonar_token: ${{ secrets.SONARQUBE_TOKEN }} # extra_args: |
# -Dsonar.projectKey=${{ github.repository }}
# -Dsonar.sources=.
# -Dsonar.inclusions=docker-compose.yml
# -Dsonar.language=yaml,docker
# - name: Check SonarQube Quality Gate
# id: quality-gate
# uses: SonarSource/sonarqube-quality-gate-action@v1.1.0
# with:
# SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }}
# sonar_token: ${{ secrets.SONARQUBE_TOKEN }}
- name: Validate Docker Compose Configuration # - name: Validate Docker Compose Configuration
if: steps.quality-gate.outputs.quality-gate-status == 'PASSED' # if: steps.quality-gate.outputs.quality-gate-status == 'PASSED'
id: docker-lint # id: docker-lint
run: | # run: |
echo "${{ secrets.DOCKER_ENV }}" > .env # echo "${{ secrets.DOCKER_ENV }}" > .env
docker compose config --no-interpolate --quiet --dry-run # docker compose config --no-interpolate --quiet --dry-run
- name: Merge Pull Request # - name: Merge Pull Request
if: steps.docker-lint.outcome == 'success' # if: steps.docker-lint.outcome == 'success'
uses: prasiman/gocurl@v1 # uses: prasiman/gocurl@v1
with: # with:
url: "${{ secrets.GITEA_API_URL }}/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ github.event.pull_request.number }}/merge" # url: "${{ secrets.GITEA_API_URL }}/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ github.event.pull_request.number }}/merge"
method: POST # method: POST
headers: | # headers: |
Authorization: token ${{ secrets.BOT_GITEA_TOKEN }} # Authorization: token ${{ secrets.BOT_GITEA_TOKEN }}
Content-Type: application/json # Content-Type: application/json
body: | # body: |
{ # {
"Do": "merge" # "Do": "merge"
} # }
deploy-main: # deploy-main:
name: Deploy to Remote Host # name: Deploy to Remote Host
needs: create-pr-and-validate # needs: create-pr-and-validate
if: github.ref == 'refs/heads/main' # if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- name: SSH to Remote Host and Deploy Docker Compose # - name: SSH to Remote Host and Deploy Docker Compose
uses: keatonLiu/docker-compose-remote-action@v1.2 # uses: keatonLiu/docker-compose-remote-action@v1.2
with: # with:
ssh_user: gitea-deploy # ssh_user: gitea-deploy
ssh_host: 192.168.1.254 # ssh_host: 192.168.1.254
ssh_private_key: ${{ secrets.DEPLOY_PRIVATE_SSH_KEY }} # ssh_private_key: ${{ secrets.DEPLOY_PRIVATE_SSH_KEY }}
ssh_host_public_key: $ ${{ secrets.DEPLOY_PUBLIC_SSH_KEY }} # ssh_host_public_key: $ ${{ secrets.DEPLOY_PUBLIC_SSH_KEY }}
compose_file_path: docker-compose.yml # compose_file_path: docker-compose.yml
args: "-d --remove-orphans --build --dry-run" # args: "-d --remove-orphans --build --dry-run"