Skip to content

docs(CONTRIBUTORS): update contributors#2218

Closed
github-actions[bot] wants to merge 1 commit intomasterfrom
contributors-update
Closed

docs(CONTRIBUTORS): update contributors#2218
github-actions[bot] wants to merge 1 commit intomasterfrom
contributors-update

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

docs(CONTRIBUTORS): update contributors

@wernerfred
Copy link
Copy Markdown
Member

@casperklein same issue again. I have an idea what might be the problem and will investigate today.

@casperklein
Copy link
Copy Markdown
Member

BTW: I think we should increase the run interval from daily to weekly|monthly to reduce the PR noise 😉

@wernerfred
Copy link
Copy Markdown
Member

wernerfred commented Sep 27, 2021

So my guess was that the required checks have a problem like we had earlier (earlier the test workflow was required too but didn't run on for example doc update PRs as the workflow explicit exclude changes to markdown files of triggering the workflow)

Currently linting is the only required check:

image

Where the worklow should run on every PR:

on:
pull_request:
branches: [ "*" ]
push:
branches:
- master

So my initial guess that we have the same problem again doesn't seem to be the case.

Weirdly enough last time it worked from the moment i did a push to the branch, to the same file. So liniting will trigger correctly even for this file.

So new guess here:

From my experience with a lot of different workflow files and github actions i remember that a workflow cannot trigger another workflow by default. This could be the case here as the PR originates from another workflow that runs.

IIRC we have two options:

  1. Use a PAT for repo related tasks instead of the automatically provided GITHUB_TOKEN as this one lacks the permission to trigger other workflows
  2. Use the trigger option on: [workflow_dispatch] to trigger another workflow (need to investigate if there is the requirement of a PAT too)

Maybe someone can confirm? @polarathene?

I am able to look into this and try to solve it but unfortunately not today and probably not before next week. So if someone wants to jump in feel free otherwise maybe set it to monthly @casperklein which gives me time to fix the current issue and can be reduced to weekly again if its working

EDIT:

Here is a link for reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token

And we would need a PAT for option 2. as well.

@polarathene

This comment has been minimized.

@polarathene

This comment has been minimized.

@github-actions github-actions Bot deleted the contributors-update branch September 28, 2021 00:01
@casperklein
Copy link
Copy Markdown
Member

Triggering the lint workflow did work. However I think, this lint-run is not "connected" to the PR #2223 the workflow created.
This PR shows again "lint Expected — Waiting for status to be reported".

Same problem: peter-evans/create-pull-request#48 (comment)

If I understand correctly, this must be updated to use a PAT:

ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}

@casperklein
Copy link
Copy Markdown
Member

Workaround: Closing and reopening the PR triggers the lint-test 😄

@polarathene

This comment has been minimized.

@polarathene

This comment has been minimized.

@polarathene
Copy link
Copy Markdown
Member

polarathene commented Sep 28, 2021

Three options to explore, I've created a PR for the last one. If that doesn't work, I don't have time to attempt the other two.


create-pull-requests action resource, prefer SSH deploy keys or Github App token over PAT

Looked into it and came across some good docs for a create-pull-requests action (links to triggering additional workflows section). That covers each of the options available to us, and why PAT is probably undesirable.

Instead of a PAT, they advise SSH deploy keys which allows for reduced scope permissions vs a PAT, but only triggers Workflows via push events. It's said to work well for the scenario we have here, pushing within the same repo to make a pull request. The lint workflow could add the contributors branch for push events and lint commits directly, then we open a PR to master (eg via that action) and we're good :)

I don't know how well that gels with your existing workflow and actions. Another option they detail is generating token via Github App, which again is preferable to using a PAT.


workflow_dispatch and repository_dispatch actions to trigger the lint workflow

Alternatively, after the contributor workflow is done, we could trigger a workflow dispatch event, this allows the contributor workflow to "manually" trigger the lint workflow, but AFAIK requires a PAT. Requires a git branch or tag name for ref, which indicates a bit of control instead of the default branch, allows for passing metadata over via inputs field. .

For workflow_dispatch triggering there's this action. Alternatively this action too, but it looks a little less maintained, it does however mention the ref can also be a commit SHA, implying the official docs are probably outdated (not surprising). Worth noting, as they use PAT, the Actions log will attribute the user of the PAT as "manually" starting the targeted workflow.

There's also this repository_dispatch event action, but I'm not sure if it allows you to configure the associated commit for the lint workflow. The official docs seem to suggest no control (API docs), so the client-payload fields in the action example are probably just to pass on metadata that you can use in your action, similar to workflow_dispatch inputs.


Final option that might work if we actually don't care about running the linting workflow:

Rough workflow snippet
- name: 'Get the latest commit hash from the contributors-update branch'
  id: commit-data
  run: 'echo "::set-output name=head_sha::$(git rev-parse contributors-update)"'

- name: 'Commit Status: Set Lint status to success (skipped)'
  uses: myrotvorets/[email protected]
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    # If the Lint workflow did run and was skipped instead, it'd still assign a "success" status. This should be valid:
    status: success
    # This should be the correct commit SHA on the contributors-update branch
    sha: ${{ steps.commit-data.outputs.head_sha }}
    # Name of status check to add/update
    context: 'lint'
    # Optional message/note we can inline to the right of the context name in the UI:
    description: "Lint skipped. Not applicable."

@polarathene
Copy link
Copy Markdown
Member

Hopefully the new PR solution works 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants