[ci] Don't run prdoc and lables GHA on master (#3257)

PR adds condition to ignore master branch for prdoc and labels GHA.

This option doesn't work because all PRs are for master thus the actions
won't start:
```yml
on:
  pull_request:
    branches-ignore:
      - master
```

This option doesn't work because actions don't see the PR number and
[break](https://github.com/paritytech/polkadot-sdk/actions/runs/7827272667/job/21354764953):
```yml
on:
  push:
    branches-ignore:
      - master
```

cc https://github.com/paritytech/ci_cd/issues/940
cc https://github.com/paritytech/polkadot-sdk/issues/3240
This commit is contained in:
Alexander Samusev
2024-02-12 11:30:46 +01:00
committed by GitHub
parent dfc8e4696c
commit c3489aaf2f
2 changed files with 16 additions and 20 deletions
+10 -8
View File
@@ -9,14 +9,6 @@ jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- name: Skip merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Pull image
env:
IMAGE: paritytech/ruled_labels:0.4.0
run: docker pull $IMAGE
- name: Check labels
env:
IMAGE: paritytech/ruled_labels:0.4.0
@@ -28,6 +20,16 @@ jobs:
RULES_PATH: labels/ruled_labels
CHECK_SPECS: "specs_polkadot-sdk.yaml"
run: |
if [ ${{ github.ref }} == "refs/heads/master" ]; then
echo "Skipping master"
exit 0
fi
if [ $(echo ${{ github.ref }} | grep -c "gh-readonly-queue") -eq 1 ]; then
echo "Skipping merge queue"
exit 0
fi
docker pull $IMAGE
echo "REPO: ${REPO}"
echo "GITHUB_PR: ${GITHUB_PR}"
+6 -12
View File
@@ -17,31 +17,25 @@ env:
jobs:
check-prdoc:
runs-on: ubuntu-latest
if: github.event.pull_request.number != ''
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
# we cannot show the version in this step (ie before checking out the repo)
# due to https://github.com/paritytech/prdoc/issues/15
- name: Skip merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Pull image
- name: Check if PRdoc is required
id: get-labels
run: |
echo "Pulling $IMAGE"
$ENGINE pull $IMAGE
- name: Check if PRdoc is required
id: get-labels
run: |
# Fetch the labels for the PR under test
echo "Fetch the labels for $API_BASE/${REPO}/pulls/${GITHUB_PR}"
labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",")
echo "Labels: ${labels}"
echo "labels=${labels}" >> "$GITHUB_OUTPUT"
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- name: Check PRDoc version
run: |
echo "Checking PRdoc version"
$ENGINE run --rm -v $PWD:/repo $IMAGE --version
- name: Early exit if PR is silent