Skip to content

Commit 01369c4

Browse files
committed
πŸƒβ€β™‚οΈ use new github action syntax
1 parent efbeb27 commit 01369c4

File tree

3 files changed

+46
-38
lines changed

3 files changed

+46
-38
lines changed

β€Ž.github/main.workflow

Lines changed: 0 additions & 9 deletions
This file was deleted.

β€Ž.github/workflows/main.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
on: pull_request
2+
3+
jobs:
4+
pr_checks:
5+
runs-on: ubuntu-latest
6+
name: verify emoji
7+
steps:
8+
- uses: actions/checkout@v2
9+
- name: verify
10+
uses: ./hack/release
11+
env:
12+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

β€Žhack/release/verify-emoji.sh

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
#!/usr/bin/env bash
2-
3-
set -eu
4-
set -o pipefail
5-
6-
pr_title=$(jq -r '.pull_request.title' < ${GITHUB_EVENT_PATH})
7-
8-
read pr_prefix rest <<<${pr_title}
9-
10-
source "$(dirname ${BASH_SOURCE})/common.sh"
11-
12-
pr_type=$(cr::symbol-type ${pr_prefix})
13-
14-
summary=""
15-
conclusion="success"
16-
if [[ ${pr_type} == "unknown" ]]; then
17-
summary="You must specify an emoji at the beginning of the PR to indicate what kind of change this is.\nValid emoji: ${cr_all_pattern}.\nYou specified '${pr_prefix}'.\nSee VERSIONING.md for more information."
18-
conclusion="failure"
19-
else
20-
summary="PR is a ${pr_type} change (${pr_prefix})."
21-
fi
22-
23-
# get the PR (the PR sent from the event has the base branch head as the head)
24-
base_link=$(jq -r '.pull_request.url' < ${GITHUB_EVENT_PATH})
25-
head_commit=$(curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -H 'Accept: application/vnd.github.antiope-preview+json' -q ${base_link} | jq -r '.head.sha')
26-
echo "head commit is ${head_commit}"
27-
28-
curl https://api.github.com/repos/${GITHUB_REPOSITORY}/check-runs -XPOST -H "Authorization: Bearer ${GITHUB_TOKEN}" -H 'Accept: application/vnd.github.antiope-preview+json' -H 'Content-Type: application/json' -q --data-raw '{"name": "Verify Emoji", "head_sha": "'${head_commit}'", "conclusion": "'${conclusion}'", "status": "completed", "completed_at": "'$(date -Iseconds)'", "output": {"title": "Verify Emoji", "summary": "'"${summary}"'"}}'
29-
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
set -o pipefail
5+
6+
pr_title=$(jq -r '.pull_request.title' < ${GITHUB_EVENT_PATH})
7+
8+
read pr_prefix rest <<<${pr_title}
9+
10+
source "$(dirname ${BASH_SOURCE})/common.sh"
11+
12+
pr_type=$(cr::symbol-type ${pr_prefix})
13+
14+
summary=""
15+
conclusion="success"
16+
if [[ ${pr_type} == "unknown" ]]; then
17+
summary="You must specify an emoji at the beginning of the PR to indicate what kind of change this is.\nValid emoji: ${cr_all_pattern}.\nYou specified '${pr_prefix}'.\nSee VERSIONING.md for more information."
18+
conclusion="failure"
19+
else
20+
summary="PR is a ${pr_type} change (${pr_prefix})."
21+
fi
22+
23+
# get the PR (the PR sent from the event has the base branch head as the head)
24+
base_link=$(jq -r '.pull_request.url' < ${GITHUB_EVENT_PATH})
25+
head_commit=$(curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -H 'Accept: application/vnd.github.antiope-preview+json' -q ${base_link} | jq -r '.head.sha')
26+
echo "head commit is ${head_commit}"
27+
28+
curl https://api.github.com/repos/${GITHUB_REPOSITORY}/check-runs -XPOST -H "Authorization: Bearer ${GITHUB_TOKEN}" -H 'Accept: application/vnd.github.antiope-preview+json' -H 'Content-Type: application/json' -q --data-raw '{"name": "Verify Emoji", "head_sha": "'${head_commit}'", "conclusion": "'${conclusion}'", "status": "completed", "completed_at": "'$(date -Iseconds)'", "output": {"title": "Verify Emoji", "summary": "'"${summary}"'"}}'
29+
30+
if [[ ${conclusion} == "failure" ]]; then
31+
exit 1
32+
else
33+
exit 0
34+
fi

0 commit comments

Comments
Β (0)