mirror of
				https://github.com/Mibew/simple-icons.git
				synced 2025-10-31 10:31:06 +03:00 
			
		
		
		
	Deduplicate get-labels and get-version steps in GHA workflows (#9789)
				
					
				
			* Deduplicate steps in GHA workflows * Minor change
This commit is contained in:
		
							parent
							
								
									30dd8a1fbf
								
							
						
					
					
						commit
						ee372033ab
					
				
							
								
								
									
										7
									
								
								.github/workflows/add-labels-priority.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.github/workflows/add-labels-priority.yml
									
									
									
									
										vendored
									
									
								
							| @ -21,10 +21,9 @@ jobs: | ||||
|       MY_GITHUB_TOKEN: ${{ secrets.AUTO_ASSIGN_WORKFLOW_TOKEN }} | ||||
|     steps: | ||||
|       - id: get-labels | ||||
|         name: Get labels | ||||
|         run: | | ||||
|           labels="$(curl --retry 5 -s https://api.github.com/repos/simple-icons/simple-icons/pulls/${{ github.event.pull_request.number }} | jq '.labels[].name' | tr '\n' ',' | sed -e 's/"//g' -e 's/,$//')" | ||||
|           echo "labels=$labels" >> $GITHUB_OUTPUT | ||||
|         uses: ./.github/workflows/get-labels.yml | ||||
|         with: | ||||
|           issue_number: ${{ github.event.pull_request.number }} | ||||
| 
 | ||||
|       - id: get-si-members | ||||
|         name: Get simple-icons members | ||||
|  | ||||
							
								
								
									
										7
									
								
								.github/workflows/autoclose-issues.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.github/workflows/autoclose-issues.yml
									
									
									
									
										vendored
									
									
								
							| @ -19,10 +19,9 @@ jobs: | ||||
|           fi | ||||
| 
 | ||||
|       - id: get-labels | ||||
|         name: Get labels | ||||
|         run: | | ||||
|           labels="$(curl --retry 5 -s https://api.github.com/repos/simple-icons/simple-icons/issues/${{ github.event.issue.number }} | jq '.labels[].name' | tr '\n' ',' | sed -e 's/"//g' -e 's/,$//')" | ||||
|           echo "labels=$labels" >> $GITHUB_OUTPUT | ||||
|         uses: ./.github/workflows/get-labels.yml | ||||
|         with: | ||||
|           issue_number: ${{ github.event.issue.number }} | ||||
| 
 | ||||
|       # if the issue is labeled as a 'new icon' and it matches Java, we | ||||
|       # - add a comment referring to the removal request | ||||
|  | ||||
							
								
								
									
										27
									
								
								.github/workflows/get-labels.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								.github/workflows/get-labels.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | ||||
| # 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 | ||||
							
								
								
									
										22
									
								
								.github/workflows/get-version.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								.github/workflows/get-version.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| # 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 | ||||
							
								
								
									
										14
									
								
								.github/workflows/publish.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								.github/workflows/publish.yml
									
									
									
									
										vendored
									
									
								
							| @ -48,11 +48,8 @@ jobs: | ||||
|           key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | ||||
|           restore-keys: | | ||||
|             ${{ runner.os }}-node- | ||||
|       - name: Get release version | ||||
|         id: get-version | ||||
|         run: | | ||||
|           export PACKAGE_VERSION=$(cat package.json | grep 'version' | sed 's/[ \",:]//g' | sed 's/version//') | ||||
|           echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT | ||||
|       - id: get-version | ||||
|         uses: ./.github/workflows/get-version.yml | ||||
|       - name: Install dependencies | ||||
|         run: npm i | ||||
|       - name: Replace CDN theme image links from README | ||||
| @ -75,11 +72,8 @@ jobs: | ||||
|       - name: Get commit message (for release title and body) | ||||
|         id: commit | ||||
|         uses: kceb/git-message-action@v2 | ||||
|       - name: Get release version | ||||
|         id: get-version | ||||
|         run: | | ||||
|           export PACKAGE_VERSION=$(cat package.json | grep 'version' | sed 's/[ \",:]//g' | sed 's/version//') | ||||
|           echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT | ||||
|       - id: get-version | ||||
|         uses: ./.github/workflows/get-version.yml | ||||
|       - 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 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user