Skip to content

Commit

Permalink
.github: Move PRChanged,PRChangedPriv,PRCPCheck,PRReCheck,PRMerge logic.
Browse files Browse the repository at this point in the history
Moved to asterisk-ci-actions reusable workflows.
  • Loading branch information
gtjoseph committed Feb 11, 2025
1 parent 7597082 commit d55b072
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 447 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/OnPRCPCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: PRCPCheck
run-name: "PR ${{ github.event.number }} ${{ github.workflow }} by ${{ github.actor }}"
on:
pull_request_target:
types: [ labeled ]

jobs:
PRCPCheck:
if: ${{ github.event.label.name == vars.CHERRY_PICK_TEST_LABEL }}
concurrency:
group: cpcheck-${{ github.event.number }}
cancel-in-progress: true
name: "run-cpcheck"
uses: asterisk/asterisk-ci-actions/.github/workflows/AsteriskPRCPCheck.yml@main
secrets:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/OnPRChanged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Workflows, like this one, that are triggered by PRs submitted
# from forked repositories are severly limited in what they can do
# for security reasons. For instance, they can't add or remove
# labels or comments even on the PR that triggered them. Since
# we need to both of those things, GitHub recommends creating a
# separate workflow that does those tasks that's triggered when
# this PR workflow starts or finishes. Since that workflow isn't
# being run in the context of a forked repo, it has all the
# privileges needed to add and remove labels and comments. The
# accompanying OnPRStateChangedPriv workflow does just that.

name: PRChanged
# WARNING! The run name MUST start with "PR <pr_number>".
# The accompanying privleged workflow parses this to find
# the PR number. It's the only reliable way it can get it.
run-name: "PR ${{ github.event.number }} Changed by ${{ github.actor }}"
on:
pull_request:
types: [opened, reopened, synchronize]

concurrency:
group: check-${{ github.event.number }}
cancel-in-progress: true

jobs:
PRChanged:
name: "run-check"
uses: asterisk/asterisk-ci-actions/.github/workflows/AsteriskPRChanged.yml@main
secrets:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:

jobs:
PRChangedPriv:
name: PRChangedPriv
uses: asterisk/asterisk-ci-actions/.github/workflows/AsteriskPRStateChangedPriv.yml@main
name: "run-checkpriv"
uses: asterisk/asterisk-ci-actions/.github/workflows/AsteriskPRChangedPriv.yml@main
secrets:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
185 changes: 0 additions & 185 deletions .github/workflows/OnPRCherryPickTest.yml

This file was deleted.

19 changes: 8 additions & 11 deletions .github/workflows/OnPRMergeApproved.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
name: MergePR
run-name: "PR ${{ github.event.number }} MergeApproved"
name: PRMerge
run-name: "PR ${{ github.event.number }} ${{ github.workflow }} by ${{ github.actor }}"
on:
pull_request_target:
types: [labeled]

concurrency:
group: ${{ github.workflow }}-${{ github.event.label.name }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
MergePR:
name: MergePR
PRMerge:
if: contains(fromJSON(vars.MERGE_APPROVED_LABELS), github.event.label.name)
uses: asterisk/asterisk-ci-actions/.github/workflows/AsteriskMergePR.yml@main
concurrency:
group: merge-${{ github.event.number }}
cancel-in-progress: true
name: "run-merge"
uses: asterisk/asterisk-ci-actions/.github/workflows/AsteriskPRMerge.yml@main
secrets:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
application_id: ${{ secrets.ASTERISK_ORG_ACCESS_APP_ID }}
application_private_key: ${{ secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY }}
Loading

0 comments on commit d55b072

Please sign in to comment.