-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (58 loc) · 1.82 KB
/
Copy pathvalidate_devops_workflow.yml
File metadata and controls
59 lines (58 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: HackerRank DevOps Validation
on:
workflow_dispatch:
# accept inputs from the user for sudorank_os
inputs:
sudorank_os:
description: "SudoRank OS"
required: false
default: "ubuntu22"
type: choice
options:
- "ubuntu22"
- "rhel8"
- "agnostic"
env:
SOLUTION_TOKEN: ${{ secrets.SOLUTION_TOKEN }}
HACKERRANK_TOKEN: ${{ secrets.QUESTION_TOKEN }}
HACKERRANK_STACKS: ${{ vars.HACKERRANK_STACKS }}
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 7
steps:
- name: Validate repo
run: |
if [[ $REPO_NAME == [[:digit:]]* ]]
then
echo 'Repo is valid =>' $REPO_NAME
else
echo 'Repo not starting with digit =>' $REPO_NAME
exit 1
fi
shell: bash
env:
REPO_NAME: ${{ github.event.repository.name }}
- name: Checkout branch
uses: actions/checkout@v6.0.3
- name: Setup Python
uses: actions/setup-python@v6.2.0
with:
python-version: "pypy3.9"
- run: pip install -r ./.github/scripts/requirements.txt
name: Install script dependencies
- run: python -u ./.github/scripts/validate_devops.py ${{ github.event.repository.name }}
name: Validate DevOps
env:
SUDORANK_OS: ${{ inputs.sudorank_os }}
- name: Find Pull Request
uses: juliangruber/find-pull-request-action@v1.11.0
id: find-pull-request
with:
branch: ${{ github.ref_name }}
- name: Approve Pull Request if found
uses: juliangruber/approve-pull-request-action@v2.1.0
if: ${{ steps.find-pull-request.outputs.number != '' }}
with:
github-token: ${{ github.token }}
number: ${{ steps.find-pull-request.outputs.number }}