File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change 32
32
echo ::add-mask::$GH_TOKEN
33
33
echo "GH_TOKEN=$GH_TOKEN" >> $GITHUB_ENV
34
34
35
+ - name : Validate pat-token input
36
+ run : |
37
+ scopes=$(gh api -i user 2>&1 | grep -i 'x-oauth-scopes:' | cut -d' ' -f2-)
38
+
39
+ if [[ -n "$scopes" && "$scopes" == *"workflow"* ]]; then
40
+ echo "✅ Token is valid and has the 'workflow' scope"
41
+ elif [[ -n "$scopes" ]]; then
42
+ echo "⚠️ Token is valid but missing the 'workflow' scope"
43
+ exit 1
44
+ else
45
+ echo "❌ Invalid token"
46
+ exit 1
47
+ fi
48
+ env :
49
+ GH_TOKEN : ${{ env.GH_TOKEN }}
35
50
36
51
- name : Load repo list from file or input
37
52
id : load_repos
Original file line number Diff line number Diff line change 42
42
echo "✅ Valid version"
43
43
else
44
44
echo "❌ Invalid version"
45
+ exit 1
45
46
fi
46
47
47
- REPOS_TO_RELEASE_INPUT="${{ github.event.inputs.repos_to_release }}"
48
- CONFIG_FILE=".github/config/repos-to-release.txt"
49
-
50
- # Convert multi-line input to table
51
- IFS=$'\n' read -d '' -r -a urls <<< "$REPOS_TO_RELEASE_INPUT"
52
-
53
- # Check earch url is contained in config file
54
- for url in "${urls[@]}"; do
55
- if ! grep -Fxq "$url" "$CONFIG_FILE"; then
56
- echo "❌ URL '$url' is unauthorized"
57
- exit 1
58
- fi
59
- done
60
-
61
- echo "✅ All URLs are valid"
62
-
63
48
- uses : actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1 v1.11.6
64
49
id : app-token
65
50
name : Generate app token
You can’t perform that action at this time.
0 commit comments