Rename repository #2204
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
on: | |
watch: | |
types: [started] | |
name: Rename repository | |
jobs: | |
run: | |
name: Rename =) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: ls | |
- run: cat contributors.json | |
- run: | | |
endings=("is-epic" "is-cool" "starred-this-repo" "starred-this-repo" "is-awesome" "is-a-unicorn") | |
selectedEnding=${endings[ $RANDOM % ${#endings[@]} ]} | |
cat contributors.json | jq -e '.|any(. == "${{github.actor}}")' > /dev/null \ | |
&& exit 1 \ | |
|| curl \ | |
-H 'Authorization: Token ${{secrets.ACCESS_TOKEN}}' \ | |
-H 'Content-Type: application/json' \ | |
-H 'Accept: application/json' \ | |
-X PATCH \ | |
--data "{\"name\": \"${{github.actor}}-$selectedEnding\"}" \ | |
"https://api.github.com/repos/${{github.repository}}" | |
- run: cat contributors.json | jq '. |= . + ["${{github.actor}}"]' > contributors2.json && mv contributors2.json contributors.json | |
- run: | | |
rm README.md | |
cat start.md > README.md | |
cat contributors.json | jq -r 'map_values("- [" + . + "](https://github.com/" + . + ")")|join("\n")' >> README.md | |
- name: Add & Commit | |
# You may pin to the exact commit or the version. | |
# uses: EndBug/add-and-commit@d77762158d703e60c60cf5baa4de52697d1414a3 | |
uses: EndBug/add-and-commit@d77762158d703e60c60cf5baa4de52697d1414a3 | |
with: | |
message: ⭐ ${{ github.actor }} |