States motion planner -> superstructure #561
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
name: Check Labels | |
on: | |
pull_request: | |
types: | |
- opened | |
- labeled | |
- unlabeled | |
- synchronize | |
jobs: | |
check-labels: | |
runs-on: ubuntu-latest | |
env: | |
PASSED_ALL_TESTS: "passed-all-tests" | |
NO_NEED_ROBOT: "no-need-of-robot-testing" | |
NO_NEED_SIMULATION: "no-need-of-simulation-testing" | |
steps: | |
- name: Get PR Labels | |
id: pr-info | |
run: | | |
LABELS=$(curl -s "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/labels" | jq -r '.[].name' | tr '\n' ' ') | |
echo "Labels for PR: ${LABELS}" | |
echo "existing_labels=${LABELS}" >> $GITHUB_ENV | |
- name: Check On Push if no need appear | |
if: ${{ github.event.action == 'synchronize' }} | |
run: | | |
EXISTING_LABELS="${{env.existing_labels}}" | |
if [[ "${EXISTING_LABELS}" =~ "${NO_NEED_ROBOT}" && "${EXISTING_LABELS}" =~ "${NO_NEED_SIMULATION}" ]]; then | |
echo "Label '${NO_NEED_ROBOT}' and label '${NO_NEED_SIMULATION}' found." | |
exit 0 | |
fi | |
echo "This is a push event and no no-need-testing was found" | |
exit 1 | |
- name: Check Absent Labels | |
run: | | |
EXISTING_LABELS="${{env.existing_labels}}" | |
declare -a absent_labels=("waiting-for-another-pr" "needs-robot-testing" "needs-simulation-testing") | |
for label in "${absent_labels[@]}"; do | |
if [[ "${EXISTING_LABELS}" =~ "${label}" ]]; then | |
echo "Label '${label}' should not be present." | |
exit 1 | |
fi | |
done | |
- name: Check Present Label | |
run: | | |
EXISTING_LABELS="${{env.existing_labels}}" | |
if [[ "${EXISTING_LABELS}" =~ "${PASSED_ALL_TESTS}" ]]; then | |
echo "Label '${PASSED_ALL_TESTS}' found." | |
exit 0 | |
fi | |
if [[ "${EXISTING_LABELS}" =~ "${NO_NEED_ROBOT}" && "${EXISTING_LABELS}" =~ "${NO_NEED_SIMULATION}" ]]; then | |
echo "Label "${NO_NEED_ROBOT}" and label "${NO_NEED_SIMULATION}" found." | |
exit 0 | |
fi | |
echo "no passed-all-tests Or no-need-of-robot-testing And no-need-of-simulation-testing was found." | |
exit 1 |