Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a64c45c

Browse files
authoredDec 3, 2024
Update build-dev.yml
1 parent 4b701b7 commit a64c45c

File tree

1 file changed

+28
-64
lines changed

1 file changed

+28
-64
lines changed
 

‎.github/workflows/build-dev.yml

+28-64
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,42 @@
1-
name: Dev build
1+
name: Test Org Membership
22

33
on:
44
workflow_dispatch:
55
inputs:
6-
submodule_path_regex:
7-
description:
8-
Regex of submodule paths to updated to HEAD before building.
9-
default: content-modules
6+
username:
7+
description: "GitHub username to check"
8+
required: true
9+
type: string
10+
org:
11+
description: "GitHub organization name"
12+
required: true
1013
type: string
1114

1215
jobs:
13-
build-and-test:
14-
name: BUILD and CHECK LINKS
16+
test-membership:
1517
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v4
1818

19-
- name: Create NPM cache-hash input file
20-
run: |
21-
mkdir -p tmp
22-
jq '{devDependencies, dependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
19+
steps:
20+
- name: Install GitHub CLI
21+
run: sudo apt-get install gh -y
2322

24-
- name: Create and use reduced-dependencies package.json
23+
- name: Check if user is a member of the org
24+
id: check-membership
2525
run: |
26-
jq 'del(.dependencies, .optionalDependencies)' \
27-
package.json > tmp/package-min.json
28-
cp tmp/package-min.json package.json
29-
30-
- uses: actions/setup-node@v4
31-
with:
32-
node-version-file: .nvmrc
33-
cache: npm
34-
cache-dependency-path: tmp/package-ci.json
35-
36-
- run: npm install --omit=optional
37-
38-
- run: npm run log:test-and-fix
39-
env:
40-
CMD_SKIP: i18n|registry
41-
GET: no # For details, see: https://opentelemetry.io/docs/contributing/development/#submodule-changes
42-
PIN_SKIP: ${{ inputs.submodule_path_regex }}
43-
44-
- uses: actions/upload-artifact@v4
45-
with:
46-
name: build-log-etc
47-
path: |
48-
tmp/build-log.txt
49-
tmp/package*.json
50-
static/refcache.json
26+
USERNAME="${{ inputs.username }}"
27+
ORG="${{ inputs.org }}"
28+
STATUS=$(gh api "orgs/$ORG/members/$USERNAME" -q '.login' || true)
29+
30+
if [[ "$STATUS" == "$USERNAME" ]]; then
31+
echo "MEMBER_FOUND=true" >> $GITHUB_ENV
32+
else
33+
echo "MEMBER_FOUND=false" >> $GITHUB_ENV
34+
fi
5135
52-
check-refcache:
53-
name: REFCACHE updates?
54-
needs: build-and-test
55-
runs-on: ubuntu-latest
56-
steps:
57-
- uses: actions/checkout@v4
58-
- uses: actions/download-artifact@v4
59-
with: { name: build-log-etc }
60-
- name: Fail when refcache contains entries with HTTP status 4XX
36+
- name: Comment on the check result
6137
run: |
62-
if grep -B 1 -e '"StatusCode": 4' static/refcache.json; then
63-
echo "Run 'npx gulp prune' to remove 4xx entries from the refcache"
64-
exit 1
38+
if [[ "$MEMBER_FOUND" == "true" ]]; then
39+
echo "✅ $USERNAME is a member of the $ORG organization."
40+
else
41+
echo "❌ $USERNAME is NOT a member of the $ORG organization."
6542
fi
66-
- name: Does the refcache need updating?
67-
run: npm run diff:fail
68-
69-
check-build-log-for-issues:
70-
name: WARNINGS in build log?
71-
needs: build-and-test
72-
runs-on: ubuntu-latest
73-
steps:
74-
- uses: actions/checkout@v4
75-
- uses: actions/download-artifact@v4
76-
with: { name: build-log-etc }
77-
- run: cat tmp/build-log.txt
78-
- run: scripts/check-build-log.sh

0 commit comments

Comments
 (0)
Please sign in to comment.