-
-
Notifications
You must be signed in to change notification settings - Fork 777
50 lines (43 loc) · 1.96 KB
/
update-label-directory.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# This workflow updates `github-actions/utils/_data/label-directory.json`
# and the Google Sheets doc `Website Labels 'Source of Truth'` at URL below
name: Update Label Directory
on:
label:
types: [edited, created, deleted]
jobs:
Update-Label-Directory:
runs-on: ubuntu-latest
if: github.repository == 'hackforla/website'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}
- name: Update label directory
id: update-label-directory
uses: actions/github-script@v7
with:
github-token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}
script: |
const script = require('./github-actions/utils/update-label-directory.js')
const labelPacket = script({g: github, c: context})
return labelPacket
# NOTE: the the URL below matches the **current deployment URL** of the Apps Script
# associated with the 'Source of Truth'Label spreadsheet and maintained by
# `[email protected]`. (If something is broken, check this link first)
- name: Send POST request to Google Apps Script
env:
label_edits: ${{ steps.update-label-directory.outputs.result }}
run: |
curl -X POST "https://script.google.com/macros/s/AKfycbw_kmDVqQW5J8wXWl1BXvJzALU6k0XYpAc5XJ7inQSyq8_opUuNg4ToBzh3Gf4M5jhw/exec" \
-H "Content-Type: application/json" \
-d "$label_edits"
# Before next step, run `git pull` so that branch is current
- name: Pull latest changes from gh-pages
run: git pull
- name: Commit changes to JSON Label Directory
uses: stefanzweifel/[email protected]
with:
# Glob pattern of file to commit, and opt. commit message + author
file_pattern: github-actions/utils/_data/label-directory.json
commit_message: Update label directory
commit_author: GitHub Actions Bot <[email protected]>