Skip to content

Commit

Permalink
ci: upgrade some actions related to planned GH deprecations (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Apr 13, 2023
1 parent 63b102d commit 731c2dc
Show file tree
Hide file tree
Showing 21 changed files with 226 additions and 204 deletions.
40 changes: 40 additions & 0 deletions .github/actions/slackify-markdown/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Composite action that can be used in other actions or workflows.
# It does not run on its own.
# Replacement for LoveToKnow/slackify-markdown-action.

name: 'Make Markdown Pretty in Slack'
description: Action used in multiple workflows to handle convertion from markdown to slack--specific-text
inputs:
markdown:
description: Markdown content
required: true
outputs:
text:
description: Slack Markdown
value: ${{ steps.slackify.outputs.text }}
runs:
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install slackify-markdown package
shell: bash
run: npm install [email protected]
- name: Slackify
uses: actions/github-script@v6
id: slackify
with:
script: |
const slackifyMarkdown = require('slackify-markdown');
try {
const md = `${{ inputs.markdown }}`;
const mrkdwn = slackifyMarkdown(md);
core.setOutput('text', mrkdwn);
} catch (error) {
core.setFailed(error.message);
}
2 changes: 1 addition & 1 deletion .github/workflows/add-good-first-issue-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add ready-to-merge label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add do-not-merge label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand All @@ -98,7 +98,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add autoupdate label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/automerge-for-humans-merging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
| join("\n")'
multiline: true
- name: Automerge PR
uses: pascalgn/automerge-action@v0.14.3
uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
MERGE_LABELS: "!do-not-merge,ready-to-merge"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Remove label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/automerge-orphans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ jobs:
name: Find orphans and notify
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get list of orphans
uses: actions/github-script@v3
uses: actions/github-script@v6
id: orphans
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -50,10 +52,10 @@ jobs:
}
- if: steps.orphans.outputs.found == 'true'
name: Convert markdown to slack markdown
uses: LoveToKnow/slackify-markdown[email protected]
uses: asyncapi/.github/.github/actions/slackify-markdown@master
id: issuemarkdown
with:
text: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
markdown: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
- if: steps.orphans.outputs.found == 'true'
name: Send info about orphan to slack
uses: rtCamp/action-slack-notify@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Autoapproving
uses: hmarr/auto-approve-action@v2
uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 is used https://github.com/hmarr/auto-approve-action/releases/tag/v3.2.1
with:
github-token: "${{ secrets.GH_TOKEN_BOT_EVE }}"

- name: Label autoapproved
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Automerging
uses: pascalgn/automerge-action@v0.13.0
uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
GITHUB_LOGIN: asyncapi-bot
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Check if Node.js project and has package.json
id: packagejson
run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
- if: steps.packagejson.outputs.exists == 'true'
name: Bumping latest version of this package in other repositories
uses: derberg/npm-dependency-manager-for-your-github-org@v4
uses: derberg/npm-dependency-manager-for-your-github-org@26a4f13d740254719971325046822a169aaa7441 # using v5.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v5.0.0
with:
github_token: ${{ secrets.GH_TOKEN }}
committer_username: asyncapi-bot
committer_email: [email protected]
repos_to_ignore: html-template # this is temporary until react component releases 1.0, then it can be removed
repos_to_ignore: html-template # this is temporary until react component releases 1.0, then it can be removed
16 changes: 8 additions & 8 deletions .github/workflows/global-replicator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Replicating file
uses: derberg/manage-files-in-multiple-repositories@54b11fb32004532b78afcb1fd64a06d37e7b6553
with:
Expand All @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Replicating file
uses: derberg/manage-files-in-multiple-repositories@54b11fb32004532b78afcb1fd64a06d37e7b6553
with:
Expand All @@ -56,7 +56,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Replicating file
uses: derberg/manage-files-in-multiple-repositories@54b11fb32004532b78afcb1fd64a06d37e7b6553
with:
Expand All @@ -73,7 +73,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Replicating file
uses: derberg/manage-files-in-multiple-repositories@54b11fb32004532b78afcb1fd64a06d37e7b6553
with:
Expand All @@ -90,7 +90,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Replicating file
uses: derberg/manage-files-in-multiple-repositories@54b11fb32004532b78afcb1fd64a06d37e7b6553
with:
Expand All @@ -109,7 +109,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Replicating file
uses: derberg/manage-files-in-multiple-repositories@54b11fb32004532b78afcb1fd64a06d37e7b6553
with:
Expand All @@ -126,7 +126,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Replicating file
uses: derberg/manage-files-in-multiple-repositories@54b11fb32004532b78afcb1fd64a06d37e7b6553
with:
Expand All @@ -143,7 +143,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Replicating file
uses: derberg/manage-files-in-multiple-repositories@54b11fb32004532b78afcb1fd64a06d37e7b6553
with:
Expand Down
60 changes: 38 additions & 22 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,48 @@ jobs:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-create-comment@v1
- name: Add comment to PR
uses: actions/github-script@v6
with:
github_token: ${{ secrets.GH_TOKEN }}
body: |
Hello, @${{ github.actor }}! 👋🏼
github-token: ${{ secrets.GH_TOKEN }}
script: |
//Yes to add comment to PR the same endpoint is use that we use to create a comment in issue
//For more details http://developer.github.com/v3/issues/comments/
//Also proved by this action https://github.com/actions-ecosystem/action-create-comment/blob/main/src/main.ts
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Hello, @${{ github.actor }}! 👋🏼
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in pull requests:

- `/ready-to-merge` or `/rtm` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
- `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
- `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.`
})

I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in pull requests:
- `/ready-to-merge` or `/rtm` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
- `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
- `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.
create_help_comment_issue:
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-create-comment@v1
- name: Add comment to Issue
uses: actions/github-script@v6
with:
github_token: ${{ secrets.GH_TOKEN }}
body: |
Hello, @${{ github.actor }}! 👋🏼
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in issues:
- `/good-first-issue {js | ts | java | go | docs | design | ci-cd} ` or `/gfi {js | ts | java | go | docs | design | ci-cd} ` - label an issue as a `good first issue`.
example: `/gfi js` or `/good-first-issue ci-cd`
github-token: ${{ secrets.GH_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Hello, @${{ github.actor }}! 👋🏼
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in issues:

- `/good-first-issue {js | ts | java | go | docs | design | ci-cd} ` or `/gfi {js | ts | java | go | docs | design | ci-cd} ` - label an issue as a `good first issue`.
example: `/gfi js` or `/good-first-issue ci-cd`
})
10 changes: 5 additions & 5 deletions .github/workflows/if-docker-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
)
id: should_run
name: Should Run
run: echo "::set-output name=shouldrun::true"
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
Expand All @@ -45,23 +45,23 @@ jobs:
- if: steps.should_run.outputs.shouldrun == 'true'
name: Check if project has a Dockerfile
id: docker
run: test -e ./Dockerfile && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
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@v1
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@v3
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@v2
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
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/if-go-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,24 @@ jobs:
)
id: should_run
name: Should Run
run: echo "::set-output name=shouldrun::true"
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- if: steps.should_run.outputs.shouldrun == 'true'
name: Check if Go project and has go.mod
id: gomod
run: test -e ./go.mod && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
run: test -e ./go.mod && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
shell: bash
- if: steps.gomod.outputs.exists == 'true'
name: Setup Go
uses: actions/setup-go@v2.1.3
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # using 4.0.0 https://github.com/actions/setup-go/releases/tag/v4.0.0
with:
go-version: 1.18
- if: steps.gomod.outputs.exists == 'true'
name: golangci-lint
uses: golangci/golangci-lint-action@v2 # golangci-lint version extracted from go.mod. `latest` if missing.
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # using v3.4.0 https://github.com/golangci/golangci-lint-action/releases/tag/v3.4.0
# golangci-lint version extracted from go.mod. `latest` if missing.
with:
skip-go-installation: true # we wanna control the version of Go in use

Expand Down Expand Up @@ -80,18 +81,18 @@ jobs:
)
id: should_run
name: Should Run
run: echo "::set-output name=shouldrun::true"
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- if: steps.should_run.outputs.shouldrun == 'true'
name: Check if Go project and has go.mod
id: gomod
run: test -e ./go.mod && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
run: test -e ./go.mod && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
shell: bash
- if: steps.gomod.outputs.exists == 'true'
name: Setup Go
uses: actions/setup-go@v2.1.3
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # using 4.0.0 https://github.com/actions/setup-go/releases/tag/v4.0.0
with:
go-version: 1.18
- if: steps.gomod.outputs.exists == 'true'
Expand Down
Loading

0 comments on commit 731c2dc

Please sign in to comment.