Skip to content

Commit 87d7cde

Browse files
committed
build: add workflow to make CLI scripts executable
1 parent c306aa5 commit 87d7cde

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2023 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Workflow name:
20+
name: update_cli_permissions
21+
22+
# Workflow triggers:
23+
on:
24+
schedule:
25+
# Run the workflow once a week (Sunday at midnight):
26+
- cron: '0 0 * * 0'
27+
28+
# Allow the workflow to be manually run:
29+
workflow_dispatch:
30+
31+
# Workflow jobs:
32+
jobs:
33+
34+
# Define a job for making CLI scripts executable:
35+
update:
36+
37+
# Define a display name:
38+
name: 'Update CLI Permissions'
39+
40+
# Define the type of virtual host machine:
41+
runs-on: ubuntu-latest
42+
43+
# Define the sequence of job steps...
44+
steps:
45+
46+
# Checkout the repository:
47+
- name: 'Checkout repository'
48+
# Pin action to full length commit SHA corresponding to v4.1.0
49+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
50+
with:
51+
# Specify whether to remove untracked files before checking out the repository:
52+
clean: true
53+
54+
# Limit clone depth to the most recent commit:
55+
fetch-depth: 1
56+
57+
# Specify whether to download Git-LFS files:
58+
lfs: false
59+
timeout-minutes: 10
60+
61+
# Make CLI scripts executable:
62+
- name: 'Make CLI scripts executable'
63+
run: |
64+
files=$(find lib/node_modules/@stdlib -type d -name 'bin' -exec find {} -type f -name 'cli' \;)
65+
66+
for file in $files; do
67+
chmod +x "$file"
68+
done
69+
70+
# Disable Git hooks:
71+
- name: 'Disable Git hooks'
72+
run: |
73+
rm -rf .git/hooks
74+
75+
# Create a pull request with the updated files:
76+
- name: 'Create pull request'
77+
id: cpr
78+
# Pin action to full length commit SHA corresponding to v5.0.2
79+
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
80+
with:
81+
title: 'fix: make CLI scripts executable'
82+
commit-message: 'fix: make CLI scripts executable'
83+
committer: 'stdlib-bot <noreply@stdlib.io>'
84+
body: |
85+
This PR changes the permissions of project `cli` scripts to be executable.
86+
token: ${{ secrets.PULL_REQUEST_TOKEN }}
87+
labels: |
88+
documentation
89+
automated-pr
90+
team-reviewers: |
91+
reviewers
92+
branch: update-cli-permissions
93+
delete-branch: true

0 commit comments

Comments
 (0)