Skip to content

Commit

Permalink
feat(workflow): add job close-pr in pull.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Sep 20, 2023
1 parent 99b14e1 commit 146ea68
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
name: PullLint
on: [ pull_request ]
jobs:
# This workflow closes invalid PR
close-pr:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Setup GitHub CLI
uses: cli/cli@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

# Runs a single command using the runners shell
- name: Get PR commit message
id: pr
run: echo "::set-output name=message::$(git log --format=%B -n 1)"

# Runs a set of commands using the runners shell
- name: Close PR if commit message is "Update main.go"
if: steps.pr.outputs.message == 'Update main.go'
run: |
echo "Closing this PR because commit message is 'Update main.go'"
gh pr close ${{ github.event.pull_request.number }} --delete-branch
golangci:
name: lint
runs-on: ubuntu-latest
Expand Down

0 comments on commit 146ea68

Please sign in to comment.