Skip to content

Commit

Permalink
test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLatsis committed Nov 2, 2024
1 parent 9c992a7 commit 0303334
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/comment_on_first_contribution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Comment on first contribution

on:
workflow_call:
inputs:
issue_message:
description: >
The Markdown message to comment when a contributor creates their first
issue.
type: string
required: false
pull_request_message:
description: >
The Markdown message to comment when a contributor creates their first
pull request.
type: string
required: false

jobs:
comment:
if: >
((github.event_name == 'pull_request_target' &&
inputs.pull_request_message) ||
(github.event_name == 'issues' && inputs.issue_message)) &&
github.event.action == 'opened'
# &&
# contains(
# fromJSON('["FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR"]'),
# github.event.author_association
# )
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- run: echo '${{ github.event.issue.author_association }}=='
- uses: actions/github-script@v7
env:
message: >-
${{
(github.event_name == 'issues')
&& inputs.issue_message
|| inputs.pull_request_message
}}
with:
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.message
})
20 changes: 20 additions & 0 deletions .github/workflows/comment_on_first_contribution_local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Comment on first contribution local

run-name: >-
Comment on first contribution in
#${{
github.event_name == 'pull_request_target'
&& github.event.pull_request.number
|| github.event.issue.number
}}
on: [pull_request_target, issues]

jobs:
comment:
uses: AnthonyLatsis/swift/.github/workflows/comment_on_first_contribution.yml@master
with:
pull_request_message: |
Test *message* (`pull request`)
New line
issue_message: "Test *message* (`issue`)"

0 comments on commit 0303334

Please sign in to comment.