Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to configure template repository #257

Merged
merged 5 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/.github/workflows/configure-repository.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# When using the Repository Template feature on GitHub, it does not follow the same rules as Composer create-project or ZIP downloads.
# For this reason, we have this script which will configure the repository the first time it is set up in order to normalize it.
name: Configure template repository

on:
# Run when branch is created (when the repository is generated from the template)
create:

# Only keep latest run of this workflow and cancel any previous runs
concurrency:
group: first-time-setup
cancel-in-progress: true

permissions:
actions: write
checks: write
contents: write

jobs:
first-time-setup:
runs-on: ubuntu-latest

# Ensure is is only run once, when the repository is generated
if: github.run_number == 1

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Remove files in export-ignore
run: |
# Read the .gitattributes file line by line
while IFS= read -r line; do
# Check if the line contains 'export-ignore'
if [[ $line == *"export-ignore"* ]]; then
# Extract the path from the line
path=$(echo "$line" | awk '{print $1}')
rm -rf "$path"
fi
done < ".gitattributes"

- name: Commit changed files
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add .
git commit -m "Configure template repository"
git push
5 changes: 0 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# README: This workflow runs some tests intended to make sure that the package works smoothly.
# This file is not included when you install Hyde normally, however it is present
# when you create a project by using the GitHub template. Unless you want to
# contribute to the project, there's no reason for you to keep this file.

name: Hyde Tests

on:
Expand Down
Loading