setup-codespace #171
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: setup-codespace | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'script/**' | |
- '*-Brewfile' | |
- '.github/workflows/*.yml' | |
# Run every Saturday at midnight | |
schedule: | |
- cron: '0 0 * * 6' | |
workflow_dispatch: | |
env: | |
CODESPACES: true | |
CODESPACE_NAME: ${{ github.workflow }}-${{ github.job }}-run-${{ github.run_id }}-attempt-${{ github.run_attempt }} | |
NOTIFICATION_URL: ${{ secrets.NOTIFICATION_URL }} | |
PUSHOVER_API_TOKEN: ${{ secrets.PUSHOVER_API_TOKEN }} | |
PUSHOVER_USER_KEY: ${{ secrets.PUSHOVER_USER_KEY }} | |
jobs: | |
bootstrap: | |
runs-on: 'ubuntu-22.04' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Validate syntax | |
run: | | |
FAILURE=0 | |
for file in script/*; | |
do | |
head -1 $file | grep -q bash && echo $file && bash -O extglob -n $file | |
# Grep fails out with 1 if it doesn't find the pattern. | |
# Bash fails out with 2 for syntax issues. | |
if [[ $? -gt 1 ]]; then | |
echo "$file failed test" | |
FAILURE=1 | |
fi | |
done | |
exit "$FAILURE" | |
- name: Run setup script | |
run: script/setup "TEST_HOSTNAME" |