Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Mar 18, 2024
2 parents f2d42ce + 2971dd0 commit 6a9ac4c
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 41 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/bounty-program-commands.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# This workflow is centrally managed at https://github.com/asyncapi/.github/
# Don't make changes to this file in this repository, as they will be overwritten with
# changes made to the same file in the abovementioned repository.

# The purpose of this workflow is to allow Bounty Team members
# (https://github.com/orgs/asyncapi/teams/bounty_team) to issue commands to the
# organization's global AsyncAPI bot related to the Bounty Program, while at the
# same time preventing unauthorized users from misusing them.

name: Bounty Program commands

on:
issue_comment:
types:
- created

jobs:
guard-against-unauthorized-use:
if: >
github.actor != ('aeworxet' || 'thulieblack') &&
(
contains(github.event.comment.body, '/bounty' )
)
runs-on: ubuntu-latest

steps:
- name: ❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command
uses: actions/github-script@v6

with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const commentText = `❌ @${{github.actor}} is not authorized to use the Bounty Program's commands.
These commands can only be used by members of the [Bounty Team](https://github.com/orgs/asyncapi/teams/bounty_team).`;
console.log(`❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command.`);
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentText
})
add-label-bounty:
if: >
github.actor == ('aeworxet' || 'thulieblack') &&
(
contains(github.event.comment.body, '/bounty' )
)
runs-on: ubuntu-latest
env:
BOUNTY_PROGRAM_LABELS_JSON: |
[
{"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"}
]
steps:
- name: Add label `bounty`
uses: actions/github-script@v6

with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const BOUNTY_PROGRAM_LABELS = JSON.parse(process.env.BOUNTY_PROGRAM_LABELS_JSON);
let LIST_OF_LABELS_FOR_REPO = await github.rest.issues.listLabelsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
});
LIST_OF_LABELS_FOR_REPO = LIST_OF_LABELS_FOR_REPO.data.map(key => key.name);
if (!LIST_OF_LABELS_FOR_REPO.includes(BOUNTY_PROGRAM_LABELS[0].name)) {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: BOUNTY_PROGRAM_LABELS[0].name,
color: BOUNTY_PROGRAM_LABELS[0].color,
description: BOUNTY_PROGRAM_LABELS[0].description
});
}
console.log('Adding label `bounty`...');
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [BOUNTY_PROGRAM_LABELS[0].name]
})
67 changes: 67 additions & 0 deletions .github/workflows/if-docker-pr-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#This action is centrally managed in https://github.com/asyncapi/.github/
#Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo
#It does magic only if there is a Dockerfile in the root of the project
name: PR testing - if Docker

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
test-docker-pr:
name: Test Docker build
runs-on: ubuntu-latest

steps:
- if: >
!github.event.pull_request.draft && !(
(github.actor == 'asyncapi-bot' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'asyncapi-bot-eve' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'allcontributors[bot]' &&
startsWith(github.event.pull_request.title, 'docs: add')
)
)
id: should_run
name: Should Run
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
uses: actions/checkout@v3

- if: steps.should_run.outputs.shouldrun == 'true'
name: Check if project has a Dockerfile
id: docker
run: test -e ./Dockerfile && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
shell: bash

- if: steps.docker.outputs.exists == 'true'
name: Set up Docker Buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # use 2.5.0 https://github.com/docker/setup-buildx-action/releases/tag/v2.5.0

- if: steps.docker.outputs.exists == 'true'
name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # use 4.3.0 https://github.com/docker/metadata-action/releases/tag/v4.3.0
with:
images: ${{ env.IMAGE_NAME }}

- if: steps.docker.outputs.exists == 'true'
name: Build Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # use 4.0.0 https://github.com/docker/build-push-action/releases/tag/v4.0.0
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
14 changes: 7 additions & 7 deletions assets/create-glee-app/templates/default/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/create-glee-app/templates/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"homepage": "https://github.com/asyncapi/glee-hello-world#readme",
"dependencies": {
"@asyncapi/glee": "^0.35.21"
"@asyncapi/glee": "^0.36.0"
},
"devDependencies": {
"@types/node": "^20.5.9"
Expand Down
8 changes: 4 additions & 4 deletions assets/create-glee-app/templates/tutorial/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/create-glee-app/templates/tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"author": "Fran Mendez",
"license": "Apache-2.0",
"dependencies": {
"@asyncapi/glee": "^0.35.21"
"@asyncapi/glee": "^0.36.0"
}
}
Loading

0 comments on commit 6a9ac4c

Please sign in to comment.