Update Label Directory #5
Workflow file for this run
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
# 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]> |