Merge branch 'main' into dev

This commit is contained in:
Elio Struyf
2023-01-07 20:18:57 +01:00
+53 -2
View File
@@ -5,8 +5,11 @@ on:
types: [created, moved, deleted]
jobs:
automate-issues-labels:
process-labels:
name: Add/remove the project label and set the matrix variable
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setVariables.outputs.matrix }}
steps:
- name: Fetch project data
run: |
@@ -14,6 +17,7 @@ jobs:
curl --request GET --url '${{ github.event.project_card.project_url }}' --header 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
### Add or remove the project label ###
- name: Add the project label
uses: andymckay/labeler@master
if: ${{ contains(github.event.action, 'created') || contains(github.event.action, 'moved') }}
@@ -24,4 +28,51 @@ jobs:
uses: andymckay/labeler@master
if: ${{ contains(github.event.action, 'deleted') }}
with:
remove-labels: "Project: ${{ fromJSON(env.PROJECT_DATA).name }}"
remove-labels: "Project: ${{ fromJSON(env.PROJECT_DATA).name }}"
### Fetch project columns ###
- name: Fetch all columns
run: |
echo 'ALL_COLUMNS_DATA<<EOF' >> $GITHUB_ENV
curl --request GET --url '${{ fromJSON(env.PROJECT_DATA).columns_url }}' --header 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' | jq --compact-output '["Status: " + .[].name]' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Set the matrix variable
id: setVariables
run: |
echo "matrix=${{ toJSON(env.ALL_COLUMNS_DATA) }}" >> $GITHUB_OUTPUT
remove-labels:
name: Remove the status label
runs-on: ubuntu-latest
needs: process-labels
strategy:
matrix:
label: ${{fromJson(needs.process-labels.outputs.matrix)}}
steps:
# One by one, as there was an issue with removing multiple labels at once
- name: Remove the status label
uses: andymckay/labeler@master
if: ${{ contains(github.event.action, 'deleted') || contains(github.event.action, 'moved') }}
with:
remove-labels: ${{ matrix.label }}
add-labels:
name: Add the status label
runs-on: ubuntu-latest
needs: remove-labels
steps:
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#project_card
- name: Fetch column info
run: |
echo 'COLUMN_DATA<<EOF' >> $GITHUB_ENV
curl --request GET --url '${{ github.event.project_card.column_url }}' --header 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Add the status label
uses: andymckay/labeler@master
if: ${{ contains(github.event.action, 'created') || contains(github.event.action, 'moved') }}
with:
add-labels: "Status: ${{ fromJSON(env.COLUMN_DATA).name }}"