1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-12-16 01:10:30 +02:00

Convert reusable workflows to actions (#9816)

This commit is contained in:
Álvaro Mondéjar 2023-11-05 20:35:53 +01:00 committed by GitHub
parent 361702ae9f
commit 380ecdaba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 53 deletions

20
.github/actions/get-labels/action.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Get issue/pull request labels
description: Get the current labels of an issue or pull request through the GitHub API
inputs:
issue_number:
description: Issue or pull request number to get labels from
required: true
outputs:
labels:
description: Labels of the issue or pull request
value: ${{ steps.get-labels.outputs.labels }}
runs:
using: composite
steps:
- id: get-labels
shell: sh
run: |
labels="$(gh api 'repos/simple-icons/simple-icons/issues/${{ inputs.issue_number }}' --jq '.labels.[].name')"
echo "labels=$labels" >> $GITHUB_OUTPUT

16
.github/actions/get-version/action.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: Get version
description: Get the current version of the project
outputs:
version:
description: The version of the project
value: ${{ steps.get-version.outputs.version }}
runs:
using: composite
steps:
- id: get-version
shell: sh
run: |
version="$(grep version -m 1 -i package.json | sed 's/[ \",:version]//g')"
echo "version=$version" >> $GITHUB_OUTPUT

View File

@ -21,7 +21,7 @@ jobs:
MY_GITHUB_TOKEN: ${{ secrets.AUTO_ASSIGN_WORKFLOW_TOKEN }}
steps:
- id: get-labels
uses: ./.github/workflows/get-labels.yml
uses: ./.github/actions/get-labels
with:
issue_number: ${{ github.event.pull_request.number }}

View File

@ -19,7 +19,7 @@ jobs:
fi
- id: get-labels
uses: ./.github/workflows/get-labels.yml
uses: ./.github/actions/get-labels
with:
issue_number: ${{ github.event.issue.number }}

View File

@ -1,27 +0,0 @@
# Get the current labels of an issue or pull request through the GitHub API
name: Get issue/pull request labels
on:
workflow_call:
inputs:
issue_number:
description: Issue or pull request number to get labels from
required: true
type: number
outputs:
labels:
description: Labels of the issue or pull request
value: ${{ jobs.get-labels.outputs.labels }}
jobs:
get-labels:
name: Get labels
runs-on: ubuntu-latest
outputs:
labels: ${{ steps.get-labels.outputs.labels }}
steps:
- id: get-labels
name: Get labels using GitHub API
run: |
labels="$(gh api 'repos/simple-icons/simple-icons/issues/${{ inputs.issue_number }}' --jq '.labels.[].name')"
echo "labels=$labels" >> $GITHUB_OUTPUT

View File

@ -1,22 +0,0 @@
# Get the current version
name: Get version
on:
workflow_call:
outputs:
version:
description: The version of the project
value: ${{ jobs.get-version.outputs.version }}
jobs:
get-version:
name: Get version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Get version from package.json
id: get-version
run: |
version="$(grep version -m 1 -i package.json | sed 's/[ \",:version]//g')"
echo "version=$version" >> $GITHUB_OUTPUT

View File

@ -49,7 +49,7 @@ jobs:
restore-keys: |
${{ runner.os }}-node-
- id: get-version
uses: ./.github/workflows/get-version.yml
uses: ./.github/actions/get-version
- name: Install dependencies
run: npm i
- name: Replace CDN theme image links from README
@ -73,7 +73,7 @@ jobs:
id: commit
uses: kceb/git-message-action@v2
- id: get-version
uses: ./.github/workflows/get-version.yml
uses: ./.github/actions/get-version
- name: Replace CDN theme image links from README
run: node ./scripts/release/strip-theme-links.js "${{ steps.get-version.outputs.version }}"
- name: Configure GIT credentials