This repository has been archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2913 from jodh-intel/actions-require-pr-porting-l…
…abels action: Require PR porting labels
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) 2020 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
name: Ensure PR has required porting labels | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- reopened | ||
- labeled | ||
- unlabeled | ||
|
||
jobs: | ||
check-pr-porting-labels: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install hub | ||
run: | | ||
HUB_ARCH="amd64" | ||
HUB_VER=$(curl -sL "https://api.github.com/repos/github/hub/releases/latest" |\ | ||
jq -r .tag_name | sed 's/^v//') | ||
curl -sL \ | ||
"https://github.com/github/hub/releases/download/v${HUB_VER}/hub-linux-${HUB_ARCH}-${HUB_VER}.tgz" |\ | ||
tar xz --strip-components=2 --wildcards '*/bin/hub' && \ | ||
sudo install hub /usr/local/bin | ||
- name: Checkout code to allow hub to communicate with the project | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.KATA_GITHUB_ACTIONS_TOKEN }} | ||
|
||
- name: Install porting checker script | ||
run: | | ||
# Clone into a temporary directory to avoid overwriting | ||
# any existing github directory. | ||
pushd $(mktemp -d) &>/dev/null | ||
git clone --single-branch --depth 1 "https://github.com/kata-containers/.github" && cd .github/scripts | ||
sudo install pr-porting-checks.sh /usr/local/bin | ||
popd &>/dev/null | ||
- name: Stop PR being merged unless it has a correct set of porting labels | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.KATA_GITHUB_ACTIONS_TOKEN }} | ||
run: | | ||
pr=${{ github.event.number }} | ||
repo=${{ github.repository }} | ||
pr-porting-checks.sh "$pr" "$repo" |