mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-03 06:14:07 +02:00
Update onpr_automerge.yaml
This commit is contained in:
62
.github/workflows/onpr_automerge.yaml
vendored
62
.github/workflows/onpr_automerge.yaml
vendored
@@ -1,43 +1,39 @@
|
|||||||
# yamllint disable rule:line-length
|
# yamllint disable rule:line-length
|
||||||
# shellcheck disable=SC2043
|
# shellcheck disable=SC2043
|
||||||
---
|
---
|
||||||
name: automerge
|
name: Automerge PRs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_review:
|
|
||||||
types:
|
|
||||||
- submitted
|
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: created
|
|
||||||
check_suite:
|
|
||||||
types:
|
types:
|
||||||
- completed
|
- created
|
||||||
status: {}
|
|
||||||
jobs:
|
jobs:
|
||||||
labeler:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Add the automerge label
|
|
||||||
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/automerge') }}
|
|
||||||
uses: actions/github-script@v4
|
|
||||||
with:
|
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
script: |
|
|
||||||
github.issues.addLabels({
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
labels: ['automerge']
|
|
||||||
})
|
|
||||||
automerge:
|
automerge:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [labeler]
|
|
||||||
steps:
|
steps:
|
||||||
- id: automerge
|
- name: Check if comment contains "/automerge"
|
||||||
if: ${{ github.event.issue.pull_request }}
|
id: check_comment
|
||||||
name: automerge
|
uses: actions/github-script@v5
|
||||||
uses: "pascalgn/automerge-action@v0.16.2"
|
with:
|
||||||
env:
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
script: |
|
||||||
Build:
|
const comment = context.payload.comment.body;
|
||||||
needs: automerge
|
return { automerge: comment.includes('/automerge') };
|
||||||
uses: ./.github/workflows/onpush_builder.yaml
|
|
||||||
|
- name: Merge PR
|
||||||
|
if: steps.check_comment.outputs.automerge
|
||||||
|
uses: actions/github-script@v5
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
const prNumber = context.payload.issue.number;
|
||||||
|
const owner = context.repo.owner;
|
||||||
|
const repo = context.repo.repo;
|
||||||
|
await github.pulls.merge({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
pull_number: prNumber,
|
||||||
|
merge_method: 'merge'
|
||||||
|
});
|
||||||
|
console.log(`PR #${prNumber} merged successfully.`);
|
||||||
|
|||||||
Reference in New Issue
Block a user