Skip to content

Commit

Permalink
feat: Added workflow for syncing CSV labels to GitHub Labels (Azure#1285
Browse files Browse the repository at this point in the history
)

**Test Run:**
https://github.com/jtracey93/bicep-registry-modules/actions/runs/8285523952/job/22673465780

This pull request introduces a new GitHub Actions workflow in the
`.github/workflows/avm.platform.sync-repo-labels-from-csv.yml` file. The
workflow is designed to synchronize labels from a CSV file to GitHub
labels. It is scheduled to run daily at 3:45 AM PST and can also be
manually triggered. The workflow runs on an Ubuntu-latest environment
and uses a PowerShell script to perform the synchronization.

Key changes include:

* New GitHub Actions workflow: A new workflow named
`avm.platform.sync-repo-labels-from-csv` has been added. This workflow
is set to run on a schedule and can also be manually triggered.
* Concurrency settings: The workflow is configured to allow only one
concurrent deployment. If a new deployment is triggered while another
one is in progress, the in-progress deployment will be cancelled.
* Permissions: The workflow has write permissions for issues and pull
requests.
* Workflow job: The workflow contains a job named `sync-labels` that
runs on an `ubuntu-latest` environment. The job uses a PowerShell script
to synchronize labels from a CSV file to GitHub labels.
  • Loading branch information
jtracey93 authored Mar 14, 2024
1 parent d264ab0 commit f36615b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/avm.platform.sync-repo-labels-from-csv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Workflow for syncing CSV labels to GitHub Labels
name: avm.platform.sync-repo-labels-from-csv

on:
schedule:
- cron: 45 11 * * * # Run daily at 3:45 AM PST
workflow_dispatch: {}

# Allow one concurrent deployment
concurrency:
group: "labels"
cancel-in-progress: true

permissions:
issues: write
pull-requests: write

defaults:
run:
shell: pwsh

jobs:
sync-labels:
runs-on: ubuntu-latest
steps:
- name: Sync AVM Labels To Repos GitHub Labels
run: |
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Azure/Azure-Verified-Modules/main/docs/static/scripts/Set-AvmGitHubLabels.ps1" -OutFile "./Set-AvmGitHubLabels.ps1"
./Set-AvmGitHubLabels.ps1 -RepositoryName "${{ github.repository }}" -CreateCsvLabelExports $false -RemoveExistingLabels $false -NoUserPrompts $true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit f36615b

Please sign in to comment.