Add webhook deduplication to prevent duplicate Lambda invocations #906
Workflow file for this run
This file contains hidden or 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
| name: Post SNS | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| permissions: | |
| pull-requests: read | |
| contents: read | |
| jobs: | |
| post-sns: | |
| if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'sns') | |
| runs-on: ubuntu-latest | |
| steps: | |
| # https://github.com/actions/checkout | |
| - uses: actions/checkout@v4 | |
| # https://github.com/actions/setup-node | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' # Updated to latest LTS version | |
| # https://github.com/plhery/node-twitter-api-v2 | |
| # https://github.com/linkedin-developers/linkedin-api-js-client#linkedin-api-javascript-client | |
| - name: Install dependencies | |
| run: | | |
| npm install twitter-api-v2 | |
| npm install linkedin-api-client | |
| npm install playwright | |
| npx playwright install chromium | |
| # https://github.com/actions/github-script | |
| - name: Post to X | |
| uses: actions/github-script@v7 | |
| continue-on-error: true | |
| with: | |
| script: | | |
| const postTwitter = require('.github/scripts/post-twitter.js'); | |
| await postTwitter({ context }); | |
| env: | |
| TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }} | |
| TWITTER_API_SECRET: ${{ secrets.TWITTER_API_SECRET }} | |
| TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
| TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
| TWITTER_API_KEY_WES: ${{ secrets.TWITTER_API_KEY_WES }} | |
| TWITTER_API_SECRET_WES: ${{ secrets.TWITTER_API_SECRET_WES }} | |
| TWITTER_ACCESS_TOKEN_WES: ${{ secrets.TWITTER_ACCESS_TOKEN_WES }} | |
| TWITTER_ACCESS_TOKEN_SECRET_WES: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET_WES }} | |
| - name: Post to LinkedIn | |
| uses: actions/github-script@v7 | |
| continue-on-error: true | |
| with: | |
| script: | | |
| const postLinkedIn = require('.github/scripts/post-linkedin.js'); | |
| await postLinkedIn({ context }); | |
| env: | |
| LINKEDIN_ACCESS_TOKEN: ${{ secrets.LINKEDIN_ACCESS_TOKEN }} | |
| - name: Post to Hacker News | |
| uses: actions/github-script@v7 | |
| continue-on-error: true | |
| with: | |
| script: | | |
| const postHackerNews = require('.github/scripts/post-hackernews.js'); | |
| await postHackerNews({ context }); | |
| env: | |
| HN_USERNAME: ${{ secrets.HN_USERNAME }} | |
| HN_PASSWORD: ${{ secrets.HN_PASSWORD }} | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |