From 2c9fd96c3fb12a6cab8f81e241e7ac96ce1939c0 Mon Sep 17 00:00:00 2001 From: Javier Bullrich Date: Fri, 3 May 2024 21:53:19 +0200 Subject: [PATCH] updated action dependencies to latest Also fixed the issue-deployment prompt not working --- .github/workflows/deploy-site.yml | 25 +++++++++---------- ...mpt-generator.yml => issue-deployment.yml} | 17 ++++++------- .github/workflows/pr-check.yml | 14 +++-------- .github/workflows/prompt-deployment.yml | 20 +++++++-------- package.json | 3 ++- 5 files changed, 35 insertions(+), 44 deletions(-) rename .github/workflows/{prompt-generator.yml => issue-deployment.yml} (85%) diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 08b3add..43828de 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -6,11 +6,11 @@ on: workflow_dispatch: inputs: post: - description: 'File name of the post to generate a share url' + description: "File name of the post to generate a share url" required: false type: string title: - description: 'The title of the new story' + description: "The title of the new story" required: false type: string @@ -23,17 +23,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install node - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - run: npm ci - run: npm run build - name: Setup Pages - uses: actions/configure-pages@v2 + uses: actions/configure-pages@v5 - name: Upload artifact - uses: actions/upload-pages-artifact@v1 + uses: actions/upload-pages-artifact@v3 with: path: ./dist - name: Deploy to GitHub Pages @@ -50,7 +50,7 @@ jobs: with: rss: "https://storybot.dev/feed.xml" - name: Publish on Reddit - uses: bluwy/release-for-reddit-action@v1 + uses: bluwy/release-for-reddit-action@v2 with: username: ${{ secrets.REDDIT_USERNAME }} password: ${{ secrets.REDDIT_PASSWORD }} @@ -62,15 +62,14 @@ jobs: flair-id: ff8e376e-c33c-11ed-9958-c667e8d429b9 - name: Send toot to Mastodon id: mastodon - uses: cbrgm/mastodon-github-action@v1 + uses: cbrgm/mastodon-github-action@v2.0.6 with: message: "I wrote a new #AI post. Read it at ${{ steps.rss.outputs.url }}" visibility: "public" - env: - MASTODON_URL: ${{ secrets.MASTODON_URL }} - MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} + access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} + url: ${{ secrets.MASTODON_URL }} - name: Publish on Twitter - uses: dart-actions/tweet@v1.0.0 + uses: dart-actions/tweet@v1.0.1 with: text: "I wrote a new #AI post using #OpenAI. Read it at ${{ steps.rss.outputs.url }}" consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }} diff --git a/.github/workflows/prompt-generator.yml b/.github/workflows/issue-deployment.yml similarity index 85% rename from .github/workflows/prompt-generator.yml rename to .github/workflows/issue-deployment.yml index d990692..224f73b 100644 --- a/.github/workflows/prompt-generator.yml +++ b/.github/workflows/issue-deployment.yml @@ -7,7 +7,7 @@ on: jobs: parse-prompt: runs-on: ubuntu-latest - if: github.event.label.name == 'prompt-1' + if: github.event.label.name == 'generate-story' permissions: issues: read contents: write @@ -15,18 +15,18 @@ jobs: steps: - name: Parse Issue Body id: parse_prompt - uses: peter-murray/issue-forms-body-parser@v3.0.0 + uses: peter-murray/issue-forms-body-parser@v4.1.0 with: issue_id: ${{ github.event.issue.number }} - separator: '###' - label_marker_start: '✒️' - label_marker_end: '🖊️' - - uses: actions/checkout@v3 + separator: "###" + label_marker_start: "✒️" + label_marker_end: "🖊️" + - uses: actions/checkout@v4 - name: Write Prompt to file run: echo '${{ fromJson(steps.parse_prompt.outputs.payload).Prompt }}' > prompt.txt - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - run: npm ci - name: Write story id: write @@ -58,4 +58,3 @@ jobs: GH_TOKEN: ${{ github.token }} run: | gh pr create --title "✍️ ${{ steps.write.outputs.title }}" --body-file body.txt - diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 4837919..97e19ae 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -2,13 +2,7 @@ name: PR Check on: pull_request: - types: [ - 'opened', - 'reopened', - 'synchronize', - 'assigned', - 'labeled', - ] + types: ["opened", "reopened", "synchronize", "assigned", "labeled"] permissions: contents: read @@ -18,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install node - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - run: npm ci - run: npm run build diff --git a/.github/workflows/prompt-deployment.yml b/.github/workflows/prompt-deployment.yml index 5223d27..34e3f20 100644 --- a/.github/workflows/prompt-deployment.yml +++ b/.github/workflows/prompt-deployment.yml @@ -16,18 +16,18 @@ jobs: steps: - name: Parse Issue Body id: parse_prompt - uses: peter-murray/issue-forms-body-parser@v3.0.0 + uses: peter-murray/issue-forms-body-parser@v4.1.0 with: issue_id: ${{ github.event.issue.number }} - separator: '###' - label_marker_start: '_' - label_marker_end: '_' - - uses: actions/checkout@v3 + separator: "###" + label_marker_start: "_" + label_marker_end: "_" + - uses: actions/checkout@v4 - name: Write story data run: echo ${{ toJson(steps.parse_prompt.outputs.payload) }} > story.json - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - run: npm ci - name: Build file id: build @@ -45,7 +45,7 @@ jobs: git pull --rebase git push --set-upstream origin main - + deploy-site: runs-on: ubuntu-latest needs: [generate-story] @@ -53,7 +53,7 @@ jobs: actions: write issues: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Deploy workflow run: gh workflow run deploy-site.yml --field post="$URL" --field title="$TITLE" env: @@ -64,5 +64,3 @@ jobs: run: gh issue close ${{ github.event.issue.number }} -r completed -c "Post released! Check it out in the [blog](https://storybot.dev/blog)!" env: GH_TOKEN: ${{ github.token }} - - diff --git a/package.json b/package.json index c892868..cebee82 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "start": "eleventy --serve --quiet", "build": "NODE_ENV=production eleventy", "write": "node scripts/content-creator.js", - "action": "node scripts/action.js" + "action": "node scripts/action.js", + "prompt": "node scripts/content-creator.js" }, "author": "Javier Bullrich ", "license": "ISC",