ci: skip if labels did not changed #10
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
name: Upload labels | |
on: | |
push: | |
branches: | |
- "main" | |
permissions: write-all | |
jobs: | |
upload-labels: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- id: labels-changed | |
run: | | |
git diff --name-only HEAD~1 HEAD | grep -q ".github/labels.yaml" | |
if [ $? -eq 0 ]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "changed=false" >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/setup-go@v4 | |
if: steps.labels-changed.outputs.changed == 'true' | |
with: | |
go-version: '1.20' | |
- if: steps.labels-changed.outputs.changed == 'true' | |
run: go install github.com/shanduur/labeler/cmd/labeler@main | |
- if: steps.labels-changed.outputs.changed == 'true' | |
run: labeler upload --owner shanduur --repo labeler ./.github/labels.yaml | |
env: | |
LABELER_TOKEN: ${{ secrets.LABELER_TOKEN }} |