Skip to content

CarID: Search for Ford Transit Parts #6

CarID: Search for Ford Transit Parts

CarID: Search for Ford Transit Parts #6

name: Create New Awesome List Entry
on:
issues:
types: [opened, edited]
permissions:
contents: read
issues: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number || github.ref }}
cancel-in-progress: false
jobs:
create-awesome-entry:
if: contains(github.event.issue.labels.*.name, 'new-resource')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install deps
run: pip install requests
- name: Analyze resource
id: analyze
env:
ISSUE_BODY: ${{ github.event.issue.body }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python .github/scripts/analyze_resource.py
- name: Comment results
uses: actions/github-script@v7
with:
script: |
const o = (name)=> core.getInput(name) || process.env[`STEP_ANALYZE_${name.toUpperCase()}`];
const body=`URL: ${{ steps.analyze.outputs.url }}\nProposed Title: ${{ steps.analyze.outputs.title }}\nProposed Category: ${{ steps.analyze.outputs.category }}\nDescription: ${{ steps.analyze.outputs.description || steps.analyze.outputs.manual_desc }}\nAppropriate: ${{ steps.analyze.outputs.appropriate }}`;
await github.rest.issues.createComment({owner:context.repo.owner,repo:context.repo.repo,issue_number:context.issue.number,body});
const existing = (await github.rest.issues.get({owner:context.repo.owner,repo:context.repo.repo,issue_number:context.issue.number})).data.labels.map(l=>l.name);
const add = ['needs-review','resource-analyzed'].filter(l=>!existing.includes(l));
if(add.length){
await github.rest.issues.addLabels({owner:context.repo.owner,repo:context.repo.repo,issue_number:context.issue.number,labels:add});
}