forked from BlueWallet/BlueWallet
-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (63 loc) · 2.03 KB
/
executable.yml
File metadata and controls
77 lines (63 loc) · 2.03 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Ensure shell scripts are executable
on:
workflow_dispatch:
push:
paths:
- "scripts/**/*.sh"
permissions:
contents: write
pull-requests: write
jobs:
chmod_x:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Compute branch vars
id: vars
shell: bash
run: |
set -euo pipefail
echo "base=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
# sanitize for branch name usage
echo "safe_base=${GITHUB_REF_NAME//\//-}" >> "$GITHUB_OUTPUT"
- name: Ensure +x on shell scripts
id: chmod
shell: bash
run: |
set -euo pipefail
mapfile -t files < <(
find scripts -type f -name "*.sh" -print | sort -u
)
changed=0
for f in "${files[@]}"; do
if [ ! -f "$f" ]; then
echo "WARNING: File not found: $f"
continue
fi
if [ -x "$f" ]; then
echo "OK: executable: $f"
else
echo "FIX: adding +x: $f"
chmod +x "$f"
changed=1
fi
done
echo "changed=$([ "$changed" -eq 1 ] && echo true || echo false)" >> "$GITHUB_OUTPUT"
- name: Create Pull Request (into same branch)
if: steps.chmod.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v8
with:
base: "${{ steps.vars.outputs.base }}"
# PR targets the same branch this ran on
commit-message: "ci: ensure shell scripts are executable (+x)"
title: "ci: ensure shell scripts are executable (+x)"
body: |
This PR ensures all shell scripts under scripts/ are marked as executable (chmod +x):
- scripts/**/*.sh
Generated automatically by GitHub Actions.
branch: "automation/chmod-shell-scripts-${{ steps.vars.outputs.safe_base }}"
delete-branch: true
labels: "ci"