Skip to content

Commit df1174a

Browse files
committed
Testing phase1
1 parent f1160d2 commit df1174a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/validate.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
on:
3+
pull_request:
4+
# types: [opened, synchronize, reopened, labeled, unlabeled]
5+
types: [labeled]
6+
pull_request_target:
7+
types: [labeled]
8+
9+
10+
permissions:
11+
issues: write # Allows the token to modify issues (needed for label management)
12+
pull-requests: write # Allows the token to interact with pull requests
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
19+
jobs:
20+
validate:
21+
name: 'Validate Changed Packages'
22+
if: contains(github.event.pull_request.labels.*.name, 'full validation')
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Run Validation Script
32+
run: |
33+
echo "Running validation because 'full validation' label was added"
34+
# Add your validation logic here (e.g., linting, testing)
35+
36+
remove-label:
37+
needs: validate
38+
if: always() # Ensures this runs even if validation fails
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Remove 'needs-validation' label
43+
run: |
44+
PR_NUMBER=${{ github.event.pull_request.number }}
45+
REPO=${{ github.repository }}
46+
LABEL="full validation"
47+
ENCODED_LABEL=$(printf "%s" "$LABEL" | sed -e 's/ /%20/g' -e 's/:/%3A/g' -e 's/\//%2F/g' -e 's/?/%3F/g' -e 's/&/%26/g' -e 's/=/%3D/g')
48+
49+
50+
echo $ENCODED_LABEL
51+
echo "https://api.github.com/repos/$REPO/issues/$PR_NUMBER/labels/$ENCODED_LABEL"
52+
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
53+
-H "Accept: application/vnd.github.v3+json" \
54+
"https://api.github.com/repos/$REPO/issues/$PR_NUMBER/labels/full%20validation"

0 commit comments

Comments
 (0)