Initial commit #2
This file contains hidden or 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: Choose the starter code of your choice | |
on: | |
push: | |
branches: [main] | |
jobs: | |
prepare-repo: | |
name: Prepare repository | |
runs-on: ubuntu-latest | |
if: github.repository != 'LS-Lab/Compilers-course-code-template' | |
permissions: | |
contents: write # we need to push! | |
steps: | |
- name: Checkout fresh repository | |
uses: actions/checkout@v4 | |
- name: Setup Git user | |
run: | | |
git config user.email "action@github.com" | |
git config user.name "GitHub Action" | |
- name: Edit README and remove this workflow | |
run: | | |
git switch main | |
mv .github/workflows/README_success.md README.md | |
sed -i "s|REPO_REF|${{ github.server_url }}/${{ github.repository }}|g" README.md | |
rm -r .github/workflows/starter-code.yaml | |
git add . | |
git commit -m "Prepare Repository for usage" | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
branch: main | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add original remote | |
run: | | |
git remote add original https://github.com/LS-Lab/Compilers-course-code-template | |
git fetch original | |
- name: Create Haskell branch | |
run: | | |
git switch -c starter/haskell original/haskell | |
git rebase -Xtheirs main | |
git push --set-upstream origin starter/haskell | |
- name: Create Java branch | |
run: | | |
git switch -c starter/java original/java | |
git rebase -Xtheirs main | |
git push --set-upstream origin starter/java |