From 89f8f86336c5abf51aa2adb5a8d5461d2ba1b1fe Mon Sep 17 00:00:00 2001 From: abbaspouraa Date: Mon, 30 Dec 2024 14:43:04 -0500 Subject: [PATCH 1/5] Add sync-labels and enforce-labels workflows --- .github/workflows/enforce-labels.yml | 17 +++++++ .github/workflows/sync-labels.yml | 72 ++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/enforce-labels.yml create mode 100644 .github/workflows/sync-labels.yml diff --git a/.github/workflows/enforce-labels.yml b/.github/workflows/enforce-labels.yml new file mode 100644 index 0000000..e7c8533 --- /dev/null +++ b/.github/workflows/enforce-labels.yml @@ -0,0 +1,17 @@ +name: Enforce PR Labels + +on: + pull_request: + types: [labeled, unlabeled, opened, edited, synchronize] + +jobs: + enforce-labels: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + with: + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + + - name: Enforce PR Labels + uses: SchemaApp/SchemaApp/.github/actions/label-enforcer@master diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml new file mode 100644 index 0000000..a753520 --- /dev/null +++ b/.github/workflows/sync-labels.yml @@ -0,0 +1,72 @@ +name: Sync Labels + +on: + push: + paths: + - '.github/labels.yml' + +jobs: + sync-labels: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Read Labels + id: read_labels + run: | + python3 < repos.txt + + - name: Trigger Sync in Other Repositories + run: | + ORG="SchemaApp" + while read REPO; do + echo "Triggering workflow for $ORG/$REPO" + curl -X POST \ + -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/$ORG/$REPO/dispatches \ + -d '{"event_type":"sync_labels"}' + done < repos.txt From 2bd5c932b9adf1922b0836fabdb69206cd93ca93 Mon Sep 17 00:00:00 2001 From: abbaspouraa Date: Mon, 30 Dec 2024 19:37:11 -0500 Subject: [PATCH 2/5] Add sync-labels and enforce-labels workflows --- .github/workflows/sync-labels.yml | 102 +++++++++++------------------- 1 file changed, 38 insertions(+), 64 deletions(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index a753520..014aa0b 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -1,72 +1,46 @@ -name: Sync Labels +name: Sync Labels from Central Repository on: - push: - paths: - - '.github/labels.yml' + repository_dispatch: + types: + - sync_labels jobs: sync-labels: runs-on: ubuntu-latest steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Read Labels - id: read_labels - run: | - python3 < repos.txt - - - name: Trigger Sync in Other Repositories - run: | - ORG="SchemaApp" - while read REPO; do - echo "Triggering workflow for $ORG/$REPO" - curl -X POST \ - -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/$ORG/$REPO/dispatches \ - -d '{"event_type":"sync_labels"}' - done < repos.txt + - name: Fetch Labels from Central Repository + run: | + curl -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ + -o labels.yml \ + https://raw.githubusercontent.com/SchemaApp/ActionDebugLife/main/.github/labels.yml + + - name: Read Labels + id: read_labels + run: | + python3 < Date: Mon, 30 Dec 2024 19:55:58 -0500 Subject: [PATCH 3/5] Add sync-labels and enforce-labels workflows --- .github/workflows/sync-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 014aa0b..3cf0eca 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -14,7 +14,7 @@ jobs: run: | curl -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ -o labels.yml \ - https://raw.githubusercontent.com/SchemaApp/ActionDebugLife/main/.github/labels.yml + https://raw.githubusercontent.com/SchemaApp/SchemaApp/master/.github/labels.yml - name: Read Labels id: read_labels From bc3956555752e5d6422b5b559489c86c471f5b89 Mon Sep 17 00:00:00 2001 From: abbaspouraa Date: Mon, 30 Dec 2024 22:28:04 -0500 Subject: [PATCH 4/5] Add sync-labels and enforce-labels workflows --- .github/workflows/sync-labels.yml | 42 +++---------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 3cf0eca..17ffb55 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -6,41 +6,7 @@ on: - sync_labels jobs: - sync-labels: - runs-on: ubuntu-latest - - steps: - - name: Fetch Labels from Central Repository - run: | - curl -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ - -o labels.yml \ - https://raw.githubusercontent.com/SchemaApp/SchemaApp/master/.github/labels.yml - - - name: Read Labels - id: read_labels - run: | - python3 < Date: Tue, 31 Dec 2024 15:49:29 -0500 Subject: [PATCH 5/5] Add sync-labels and enforce-labels workflows --- .github/workflows/sync-labels.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 17ffb55..119f162 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -9,4 +9,6 @@ jobs: call-reusable-workflow: uses: SchemaApp/SchemaApp/.github/workflows/sync-labels.yml@master with: - labels_url: ${{ github.event.client_payload.labels_url }} + labels_url: https://raw.githubusercontent.com/SchemaApp/SchemaApp/master/.github/labels.yml + secrets: + PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} \ No newline at end of file