Skip to content

Config: workflow 오류 수정 #1

Config: workflow 오류 수정

Config: workflow 오류 수정 #1

Workflow file for this run

ame: Main Server Pull-request

Check failure on line 1 in .github/workflows/main_pr.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main_pr.yml

Invalid workflow file

The workflow is not valid. .github/workflows/main_pr.yml (Line: 1, Col: 1): Unexpected value 'ame'
on:
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check branch
run: |
echo "Head branch is: ${{ github.head_ref }}"
echo "Base branch is: ${{ github.base_ref }}"
if [[ "${{ github.head_ref }}" != "test" ]]; then
echo "test 브랜치가 아님"
exit 1
fi
- name: Checkout source code. # Repo checkout
uses: actions/checkout@v3
- name: Set application.properties from secrets
run: |
echo "${{ secrets.MAIN_APPLICATION_PROPERTIES }}" > src/main/resources/application.properties
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
after:
runs-on: ubuntu-latest
needs: build
if: always()
permissions:
contents: read
pull-requests: write
steps:
- name: Comment on failure and close PR
if: needs.build.result == 'failure'
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '빌드 실패'
});
github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
state: 'closed'
});
- name: Auto approve pull request
if: needs.build.result == 'success'
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
event: 'APPROVE'
});