Skip to content

Commit

Permalink
Merge pull request #13 from clerk/lekoarts/fix-actions
Browse files Browse the repository at this point in the history
fix: GitHub actions
  • Loading branch information
LekoArts authored Jan 23, 2025
2 parents 8dc80aa + 616f8c2 commit 1c08598
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
11 changes: 7 additions & 4 deletions .github/utils/slack-notify.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const slackFormatter = {
});
const blocks = [];

blocks.push(header(`openapi-specs: ${title}`));
blocks.push(header(title));

blocks.push(markdown(body));
blocks.push(markdown('\n'));
Expand All @@ -62,9 +62,12 @@ const createActor = username => {
};

const run = async () => {
const { title, user, html_url } = JSON.parse(process.argv[2]);
const body = process.argv[3];
const actor = createActor(user.login);
// Input arguments order will be: title actor html_url body
const title = process.argv[2];
const user_login = process.argv[3];
const html_url = process.argv[4];
const body = process.argv[5];
const actor = createActor(user_login);

const formatter = formatters['slack'];
if (!formatter) {
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/linear-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,11 @@ jobs:
steps:
- name: Create Linear ticket
id: createIssue
uses: ctriolo/action-create-linear-issue@v0.5
uses: ctriolo/action-create-linear-issue@v0.7
with:
linear-api-key: ${{ secrets.LINEAR_API_KEY }}
linear-team-key: "ECO"
linear-issue-title: ${{ github.event.pull_request.title }}
linear-issue-description: ${{ github.event.pull_request.body }}
linear-attachment-url: ${{ github.event.pull_request.html_url }}
linear-attachment-title: ${{ github.event.pull_request.title }}

- name: Create comment for Linear ticket link
uses: marocchino/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.CLERK_COOKIE_PAT }}
number: ${{ github.event.issue.number }}
header: linear-issue-url
message: |
A Linear ticket has been created for this PR: ${{ steps.createIssue.outputs.linear-issue-url }}
12 changes: 8 additions & 4 deletions .github/workflows/slack-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
slack-notify:
name: Slack Notification
runs-on: ubuntu-latest
env:
PULL_REQUEST_BODY: ${{ github.event.pull_request.body }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand All @@ -18,19 +20,21 @@ jobs:
id: slackify
uses: LoveToKnow/[email protected]
with:
text: ${{ github.event.pull_request.body }}
text: ${{ env.PULL_REQUEST_BODY }}
- name: Generate notification payload
id: notification
env:
PULL_REQUEST_DATA: ${{ toJson(github.event.pull_request) }}
TITLE: ${{ github.event.pull_request.title }}
USER_LOGIN: ${{ github.event.pull_request.user.login }}
HTML_URL: ${{ github.event.pull_request.html_url }}
run: |
payload=$(node ./.github/utils/slack-notify.mjs '${{ env.PULL_REQUEST_DATA }}' '${{ steps.slackify.outputs.text }}')
payload=$(node ./.github/utils/slack-notify.mjs '${{ env.TITLE }}' '${{ env.USER_LOGIN }}' '${{ env.HTML_URL }}' '${{ steps.slackify.outputs.text }}')
echo "payload=${payload//$'\n'/'%0A'}" >> $GITHUB_OUTPUT
- name: Send PR to Slack
id: slack
uses: slackapi/[email protected]
with:
payload: ${{ steps.notification.outputs.payload }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CHANGELOG_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

0 comments on commit 1c08598

Please sign in to comment.