Skip to content

Commit

Permalink
test(github-action): refactor command handler (#103)
Browse files Browse the repository at this point in the history
Refactor command handler workflow to use bot name from secrets.
  • Loading branch information
parfeon authored Jan 3, 2023
1 parent 06d1be7 commit 9cfff38
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 127 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/commands-handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,41 @@ name: Commands processor
on:
issue_comment:
types: [created]
defaults:
run:
shell: bash

jobs:
process:
name: Process command
if: ${{ github.event.issue.pull_request && endsWith(github.repository, '-private') != true && startsWith(github.event.comment.body, '@client-engineering-bot ') }}
if: github.event.issue.pull_request && endsWith(github.repository, '-private') != true
runs-on: ubuntu-latest
steps:
- name: Check referred user
id: user-check
env:
CLEN_BOT: ${{ secrets.CLEN_BOT }}
run: echo "expected-user=${{ startsWith(github.event.comment.body, format('@{0} ', env.CLEN_BOT)) }}" >> $GITHUB_OUTPUT
- name: Regular comment
if: steps.user-check.outputs.expected-user != 'true'
run: echo -e "\033[38;2;19;181;255mThis is regular commit which should be ignored.\033[0m"
- name: Checkout repository
uses: actions/checkout@v2
if: steps.user-check.outputs.expected-user == 'true'
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- name: Checkout release actions
uses: actions/checkout@v2
if: steps.user-check.outputs.expected-user == 'true'
uses: actions/checkout@v3
with:
repository: pubnub/client-engineering-deployment-tools
ref: v1
token: ${{ secrets.GH_TOKEN }}
path: .github/.release/actions
- name: Process changelog entries
if: steps.user-check.outputs.expected-user == 'true'
uses: ./.github/.release/actions/actions/commands
with:
token: ${{ secrets.GH_TOKEN }}
listener: client-engineering-bot
listener: ${{ secrets.CLEN_BOT }}
jira-api-key: ${{ secrets.JIRA_API_KEY }}
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
check-release:
name: Check release required
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged && endsWith(github.repository, '-private') != true }}
if: github.event.pull_request.merged && endsWith(github.repository, '-private') != true
outputs:
release: ${{ steps.check.outputs.ready }}
steps:
- name: Checkout actions
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: pubnub/client-engineering-deployment-tools
ref: v1
Expand All @@ -29,15 +29,15 @@ jobs:
name: Publish package
runs-on: ubuntu-latest
needs: check-release
if: ${{ needs.check-release.outputs.release == 'true' }}
if: needs.check-release.outputs.release == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# This should be the same as the one specified for on.pull_request.branches
ref: master
- name: Checkout actions
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: pubnub/client-engineering-deployment-tools
ref: v1
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/run-validations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Validations

on:
push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash

jobs:
repository-validators:
name: 'Validate .pubnub.yml'
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Checkout validator action
uses: actions/checkout@v3
with:
repository: pubnub/client-engineering-deployment-tools
ref: v1
token: ${{ secrets.GH_TOKEN }}
path: .github/.release/actions
- name: "Run '.pubnub.yml' file validation"
uses: ./.github/.release/actions/actions/validators/pubnub-yml
with:
token: ${{ secrets.GH_TOKEN }}
24 changes: 0 additions & 24 deletions .github/workflows/validate-pubnub-yml.yml

This file was deleted.

94 changes: 0 additions & 94 deletions .github/workflows/validate-yml.js

This file was deleted.

0 comments on commit 9cfff38

Please sign in to comment.