Create Starline for arnaudcharles/psbite #8349
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: Create Starline | |
| run-name: "Create Starline for ${{ github.event.inputs.resource }}" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| resource: | |
| required: true | |
| concurrency: | |
| group: ${{ github.event.inputs.resource }} | |
| cancel-in-progress: false | |
| jobs: | |
| create-starline: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Validate inputs | |
| uses: actions/github-script@v7 | |
| with: | |
| result-encoding: string | |
| retries: 3 | |
| script: | | |
| if(process.env.INPUT_RESOURCE?.match(/\s+/)) { | |
| core.failure(`inputs.resource must not contain whitespaces, but was'${process.env.INPUT_RESOURCE}'`) | |
| } | |
| env: | |
| INPUT_RESOURCE: "${{ github.event.inputs.resource }}" | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - run: npm ci | |
| - name: Add starline to step summary | |
| run: | | |
| if [[ ! "$ASSET" == *"/"* ]]; then | |
| echo "[$ASSET](https://github.com/$ASSET)" >> $GITHUB_STEP_SUMMARY | |
| elif [[ "$ASSET" == *@gist ]]; then | |
| echo "[$ASSET](https://gist.github.com/${ASSET%@gist})" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "[$ASSET](https://github.com/$ASSET)" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| env: | |
| ASSET: ${{ github.event.inputs.resource }} | |
| - run: node create-starline.js ${{ github.event.inputs.resource }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GIST_GITHUB_TOKEN: ${{ secrets.GIST_GITHUB_TOKEN }} | |
| - name: Add starline to step summary | |
| run: | | |
| echo "[](https://github.com/qoomon/starlines/releases/download/starlines/$(echo "$ASSET" | sed 's/[\/@]/--/g')--starline.svg)" >> $GITHUB_STEP_SUMMARY | |
| env: | |
| ASSET: ${{ github.event.inputs.resource }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: starlines/${{ github.event.inputs.resource }}/starline.svg |